[PATCH] D95840: [CUDA][HIP] Fix checking dependent initalizer
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 3 11:39:51 PST 2021
yaxunl marked 2 inline comments as done.
yaxunl added inline comments.
================
Comment at: clang/lib/Sema/SemaCUDA.cpp:538
AllowedInit =
- ((VD->getType()->isDependentType() || Init->isValueDependent()) &&
- VD->isConstexpr()) ||
+ (VD->getType()->isDependentType() || Init->isValueDependent()) ||
Init->isConstantInitializer(Context,
----------------
tra wrote:
> Nit, no need for `()` any more, as all parts of the expression ar `||`-ed together.
will do
================
Comment at: clang/test/SemaCUDA/dependent-device-var.cu:8
+__device__ int fun1(T x) {
+ static __device__ int a = sizeof(x);
+ static __device__ int b = x;
----------------
tra wrote:
> So, the patch now allows using type-dependent constant expressions now.
> I'd add a comment highlighting this. It's not always obvious that the test's purpose is to verify the absence of an error.
will do
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95840/new/
https://reviews.llvm.org/D95840
More information about the cfe-commits
mailing list