Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: define PYBIND11_CPP14 for recent intel compilers #2679

Merged

Conversation

tobiasleibner
Copy link
Contributor

@tobiasleibner tobiasleibner commented Nov 19, 2020

I just encountered #1649 with the Intel compiler 2021 (beta). Recent Intel compilers seem to support C++14 just fine, so just defining PYBIND11_CPP14 for recent Intel compilers should fix the problem.

EDIT (@YannickJadoul): Closes #1649

Suggested changelog entry:

* Intel compiler was not activating C++14 support due to a broken define.

@tobiasleibner tobiasleibner force-pushed the fix_overload_cast_with_intel_compiler branch from 930e2d9 to ca5494f Compare November 19, 2020 08:01
dune-community-bot pushed a commit to dune-community/dune-xt that referenced this pull request Nov 19, 2020
@YannickJadoul YannickJadoul added this to the v2.6.2 milestone Nov 19, 2020
@@ -27,7 +27,11 @@
# endif
#endif

#if !(defined(_MSC_VER) && __cplusplus == 199711L) && !defined(__INTEL_COMPILER)
#if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1900
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really only added on 19? We only support 18+, so it's much simpler if it was added in 18. :'( I don't see anything specific in the release notes for 19 that indicate that they just started defining __cplusplus.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess __cplusplus is already defined for 18, but the first comment in #1649 mentions that the C++14 support is not sufficient in that version. I will check the value of __cplusplus in version 18.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, __cplusplus is already defined to 201402L in version 18. So it should work in theory, but apparently it does not work in practice, see #1649. To support version 18, we thus would have to add specializations to work around the intel compiler bugs, I guess.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better than forcing C++ mode to 11 if 14 is requested. It would even be better, IMO, to throw an error if 14 is requested instead of using 11 when 14 is set, with a statement like "only C++11 is supported with Intel 18". I could make a quick attempt to get this working on Intel 18 before doing something like that.

It would be so much nicer if we could test this in CI, but only the most recent version is available and it doesn't work (#2573 )

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of adding workarounds to support a compiler lying about supporting C++14, though :-/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the minimum, let's kill the Intel specific limiting here. Since we already have a list of #error printouts for minimum supported compilers, we could add on that forces Intel 18 to C++11 mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the first check and added an error message.

@tobiasleibner tobiasleibner force-pushed the fix_overload_cast_with_intel_compiler branch from ca5494f to cd67921 Compare November 19, 2020 20:03
@henryiii henryiii self-requested a review November 23, 2020 04:04
@henryiii henryiii merged commit 7bd4b39 into pybind:master Nov 23, 2020
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Nov 23, 2020
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Dec 22, 2020
@henryiii henryiii added needs changelog Possibly needs a changelog entry and removed needs changelog Possibly needs a changelog entry labels Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overload_cast failure with recent Intel compilers
4 participants