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

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 04:56:07 PDT 2023


cor3ntin 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}}
----------------
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155175



More information about the cfe-commits mailing list