[clang] Don't wrap immediate invocations in ConstantExprs within constexpr initializers (PR #89565)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 22 04:08:58 PDT 2024


================
@@ -1032,17 +1043,15 @@ int f() {
 
 namespace GH57682 {
 void test() {
-  constexpr auto l1 = []() consteval { // expected-error {{cannot take address of consteval call operator of '(lambda at}} \
-                                       // expected-note  2{{declared here}}
+  constexpr auto l1 = []() consteval { // expected-note  {{declared here}}
         return 3;
   };
   constexpr int (*f1)(void) = l1; // expected-error {{constexpr variable 'f1' must be initialized by a constant expression}} \
                                   // expected-note  {{pointer to a consteval declaration is not a constant expression}}
 
 
-  constexpr auto lstatic = []() static consteval { // expected-error {{cannot take address of consteval call operator of '(lambda at}} \
-                                       // expected-note  2{{declared here}} \
-                                       // expected-warning {{extension}}
+  constexpr auto lstatic = []() static consteval { // expected-note  {{declared here}} \
+                                                   // expected-warning {{extension}}
----------------
cor3ntin wrote:

Do we have existing tests for assigning the address of a lambda to a non constexpr variable?

https://github.com/llvm/llvm-project/pull/89565


More information about the cfe-commits mailing list