[PATCH] D155175: [Clang] Fix consteval propagation for aggregates and defaulted constructors

Mariya Podchishchaeva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 05:03:22 PDT 2023


Fznamznon added inline comments.


================
Comment at: clang/test/SemaCXX/cxx2a-consteval-default-params.cpp:48
 
-struct InitWithLambda {
-    int b = [](int error = undefined()) { // expected-error {{cannot take address of consteval function 'undefined' outside of an immediate invocation}}
+struct InitWithLambda { // expected-note {{'InitWithLambda' is an immediate constructor because the default initializer of 'b' contains a call to a consteval function 'undefined' and that call is not a constant expression}}
+    int b = [](int error = undefined()) {  // expected-note {{undefined function 'undefined' cannot be used in a constant expression}}
----------------
cor3ntin wrote:
> Fznamznon wrote:
> > Maybe it makes sense to print `InitWithLambda::InitWithLambda` so it looks same as "call to immediate function ... is not a constant expression" message and makes it more obvious.
> I don't disagree but for some reason default constructors are printed that way... I'd have to make the diagnostics even more complicated and it did not feel worth it.
Ok, I see! Yes, I don't feel that making it more complicated is worth it too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155175



More information about the llvm-commits mailing list