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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 11:17:22 PDT 2022


aaron.ballman added a subscriber: rsmith.
aaron.ballman added a comment.

This is generally looking good to me, thank you! Just a few minor points and I think this will be ready.



================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:7551
+  //   expression.
+  if (isa<ClassTemplateSpecializationDecl>(RD) && MD->isConstexpr())
+    Constexpr = true;
----------------
On my earlier patch, @rsmith had suggested that we check if `MD` is being instantiated here rather than `RD` to more closely match the standards wording. I think that's a reasonable suggestion -- WDYT?


================
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()'}}
----------------
Why do we need to use the regex here (and elsewhere)?


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