[PATCH] D131479: Handle explicitly defaulted consteval special members.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 05:19:44 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/test/SemaCXX/cxx2a-consteval.cpp:805
+void func() {
+  default_ctor<foo> fail0; // expected-error-re {{call to consteval function '{{.*::default_ctor<.*::foo>}}::default_ctor' is not a constant expression}} \
+                              expected-note {{in call to 'default_ctor()'}}
----------------
usaxena95 wrote:
> aaron.ballman wrote:
> > Why do we need to use the regex here (and elsewhere)?
> I wanted to omit the namespace name in the error messages and make the namespace more descriptive. See the `.*` in the error messages.
I think it's better to skip the regex and spell out the diagnostic fully (even with the descriptive namespace name). Regular expression matching is going to be slower than regular matching (generally) and there's no real need for it here except brevity.


================
Comment at: clang/test/SemaCXX/cxx2a-consteval.cpp:812
+  fail1 = good0;          // expected-error-re {{call to consteval function '{{.*::copy<.*::foo>}}::operator=' is not a constant expression}} \
+                             expected-note {{in call to '&fail1->operator=(good0)'}}
+
----------------
shafik wrote:
> aaron.ballman wrote:
> > This likely has nothing to do with your changes here, but what the heck is with that leading `&`  in this already-pretty-surprisingly-weird note? Is that aiming for `(&fail1)->operator=(good0)` for some reason?
> Note, we also see a similar diagnostic in `SemaCXX/constant-expression-cxx11.cpp` so this looks like it existed before.
Good catch! I filed https://github.com/llvm/llvm-project/issues/57081 so that hopefully we go back to make that wording better some day.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131479



More information about the cfe-commits mailing list