[PATCH] D79237: [CUDA][HIP] Fix constexpr variables for C++17

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 15 16:52:24 PDT 2020


rsmith added a comment.

In D79237#2039559 <https://reviews.llvm.org/D79237#2039559>, @tra wrote:

> In D79237#2039417 <https://reviews.llvm.org/D79237#2039417>, @tra wrote:
>
> >
>
>
> Bad news -- it breaks the standard C++ library.


[...]

>   build/release+assert+zapcc/bin/../include/c++/v1/utility:937:51: error: dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.
>   _LIBCPP_INLINE_VAR constexpr in_place_type_t<_Tp> in_place_type{};
>                                                     ^            ~~

This looks like a bug in that diagnostic: the instantiations of this variable template certainly do not have dynamic initialization. The diagnostic is missing an "in instantiation of" note, so I think the bug is that we're performing this check on a dependent variable prior to instantiation. Presumably we should delay the check to instantiation time if either the type of the variable is dependent or the initializer is value-dependent.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79237/new/

https://reviews.llvm.org/D79237





More information about the cfe-commits mailing list