Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Disable __builtin_is_constant_evaluated with NVCC in C++11 mode #21

Merged

Conversation

wmaxey
Copy link
Member

@wmaxey wmaxey commented Sep 23, 2020

NVCC reports that uses of __builtin_is_constant_evaluated in a constexpr evaluation are invalid:

detail/libcxx/include/type_traits(4835): error #2416-D: constexpr function return is non-constant

The fix for now is a WAR that removes the use of the builtin when compiling under NVCC:

I've added a test that should let us know when it's functioning again.

@brycelelbach brycelelbach added this to the 1.3.0 milestone Sep 28, 2020
@wmaxey wmaxey force-pushed the bugfix/clang_type_traits_constexpr_non-constant branch from fae861b to 06a3622 Compare October 1, 2020 18:32
#if __cplusplus < 201402L
#undef _LIBCUDACXX_IS_CONSTANT_EVALUATED
#endif
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we do this without an #undef by moving it into the NVCC configuration section, and only defining _LIBCUDACXX_IS_CONSTANT_EVALUATED if not Clang 9 and not C++11?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also I'm confused, does this affect GCC too? If so we should have the comment say that. The test indicates it affects GCC 9 and 10 and Clang 9 and 10?

@brycelelbach brycelelbach force-pushed the bugfix/clang_type_traits_constexpr_non-constant branch from 06a3622 to aed10ad Compare October 2, 2020 23:16
@brycelelbach brycelelbach changed the title Fix builds for clang & c++11 Disable __builtin_is_constant_evaluated with NVCC in C++11 mode Oct 2, 2020
@brycelelbach brycelelbach force-pushed the bugfix/clang_type_traits_constexpr_non-constant branch from aed10ad to 2b08299 Compare October 2, 2020 23:17
@brycelelbach brycelelbach force-pushed the bugfix/clang_type_traits_constexpr_non-constant branch from 2b08299 to d098a95 Compare October 2, 2020 23:37
@wmaxey wmaxey merged commit cbedc0a into NVIDIA:main Oct 3, 2020
@wmaxey wmaxey deleted the bugfix/clang_type_traits_constexpr_non-constant branch October 3, 2020 01:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants