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

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 15 15:47:14 PDT 2020


tra added inline comments.


================
Comment at: clang/test/SemaCUDA/constexpr-variables.cu:30-31
+  static constexpr int c = sizeof(a);
+  a[0] = &b;
+  a[1] = &c;
+  foo(a);
----------------
yaxunl wrote:
> tra wrote:
> > Can we verify the diags for bad cases, too?
> By bad cases you mean the constexpr var is not compile time constant?
It's a general suggestion. It's good to have some negative testing thrown in, too to make sure we didn't do too much by mistake.  E.g. allowing all variables to become `__constant__` would be bad. :-)

I'm not sure what exactly would be a good addition here. If you can't think of something, I guess we can leave it as is. C++ is largely oblivoius of `__constant__`, so we may not have much to work with. It's probably observable, but may be an overkill for the test.



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

https://reviews.llvm.org/D79237





More information about the cfe-commits mailing list