yaxunl marked an inline comment as done.
yaxunl added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:10286
+          // these variables must be a compile time constant.
+          VDecl->getType().getAddressSpace() == LangAS::opencl_constant)
         CheckForConstantInitializer(Init, DclT);
----------------
rjmccall wrote:
> Should this rule apply even in C++ mode?  I can't remember if there are any 
> OpenCL/C++ hybrids.
No. This rule (static local variable needs to be initialised with compile-time 
constant) only applies to C and OpenCL. 
In C++ static local variable can be initialised with non-compile-time constant, 
in which case Clang will emit atomic instructions to make sure it is only 
initialised once.

Currently OpenCL 2.2 defines OpenCL C++ but clang does not support it.


https://reviews.llvm.org/D32977



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to