[PATCH] D68753: [CUDA][HIP} Add a test for constexpr default ctor

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 14:05:49 PDT 2019


tra added inline comments.


================
Comment at: test/SemaCUDA/constexpr-ctor.cu:14-27
+template <class T> struct B {
+  T a;
+  constexpr B() = default;
+};
+
+template <class T> struct C {
+  T a;
----------------
yaxunl wrote:
> tra wrote:
> > Do we really need three identical templates? If they are needed to let compiler emit multiple diagnostics, perhaps we could just add another template parameter so we can get different instantiations.
> the error is emitted on the default ctor of the template. If we do not use different templates, all errors are emitted on the same line, we cannot make sure some instantiations do not cause error and some instantiations should cause error.
> 
> Adding template parameter will not help, because the error will still be emitted to the same line.
Having multiple errors attributed to the same source is OK. You can specify expected count. E.g.
`dev-error 2 {{something}}`. Single template appears to be sufficient (https://godbolt.org/z/G3WvYD).

You'll have different note diags emitted for individual errors, so checking them would both provide more info about that exactly the problem is and will verify that they are reported in the correct locations. Right now you are describing what/where triggers an error that as a comment. Letting compiler verify that instead would be better, IMO.




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

https://reviews.llvm.org/D68753





More information about the cfe-commits mailing list