1 // RUN: %clang_cc1 -std=c++14 -Wno-unused-value -fsyntax-only -verify -verify=expected-cxx14 -fblocks %s 2 // RUN: %clang_cc1 -std=c++17 -Wno-unused-value -verify -ast-dump -fblocks %s | FileCheck %s 3 4 namespace std { class type_info; }; 5 6 namespace ExplicitCapture { 7 class C { 8 int Member; 9 10 static void Overload(int); 11 void Overload(); 12 virtual C& Overload(float); 13 14 void ImplicitThisCapture() { 15 []() { (void)Member; }; // expected-error {{'this' cannot be implicitly captured in this context}} expected-note {{explicitly capture 'this'}} 16 const int var = []() {(void)Member; return 0; }(); // expected-error {{'this' cannot be implicitly captured in this context}} expected-note {{explicitly capture 'this'}} 17 [&](){(void)Member;}; 18 19 [this](){(void)Member;}; 20 [this]{[this]{};}; 21 []{[this]{};};// expected-error {{'this' cannot be implicitly captured in this context}} 22 []{Overload(3);}; 23 [] { Overload(); }; // expected-error {{'this' cannot be implicitly captured in this context}} expected-note {{explicitly capture 'this'}} 24 []{(void)typeid(Overload());}; 25 [] { (void)typeid(Overload(.5f)); }; // expected-error {{'this' cannot be implicitly captured in this context}} expected-note {{explicitly capture 'this'}} 26 } 27 }; 28 29 void f() { 30 [this] () {}; // expected-error {{'this' cannot be captured in this context}} 31 } 32 } 33 34 namespace ReturnDeduction { 35 void test() { 36 [](){ return 1; }; 37 [](){ return 1; }; 38 [](){ return ({return 1; 1;}); }; 39 [](){ return ({return 'c'; 1;}); }; // expected-error {{must match previous return type}} 40 []()->int{ return 'c'; return 1; }; 41 [](){ return 'c'; return 1; }; // expected-error {{must match previous return type}} 42 []() { return; return (void)0; }; 43 [](){ return 1; return 1; }; 44 } 45 } 46 47 namespace ImplicitCapture { 48 void test() { 49 int a = 0; // expected-note 5 {{declared}} 50 []() { return a; }; // expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{begins here}} expected-note 2 {{capture 'a' by}} expected-note 2 {{default capture by}} 51 [&]() { return a; }; 52 [=]() { return a; }; 53 [=]() { int* b = &a; }; // expected-error {{cannot initialize a variable of type 'int *' with an rvalue of type 'const int *'}} 54 [=]() { return [&]() { return a; }; }; 55 []() { return [&]() { return a; }; }; // expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-note 2 {{capture 'a' by}} expected-note 2 {{default capture by}} 56 []() { return ^{ return a; }; };// expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-note 2 {{capture 'a' by}} expected-note 2 {{default capture by}} 57 []() { return [&a] { return a; }; }; // expected-error 2 {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note 2 {{lambda expression begins here}} expected-note 4 {{capture 'a' by}} expected-note 4 {{default capture by}} 58 [=]() { return [&a] { return a; }; }; // 59 60 const int b = 2; 61 []() { return b; }; 62 63 union { // expected-note {{declared}} 64 int c; 65 float d; 66 }; 67 d = 3; 68 [=]() { return c; }; // expected-error {{unnamed variable cannot be implicitly captured in a lambda expression}} 69 70 __block int e; // expected-note 2{{declared}} 71 [&]() { return e; }; // expected-error {{__block variable 'e' cannot be captured in a lambda expression}} 72 [&e]() { return e; }; // expected-error {{__block variable 'e' cannot be captured in a lambda expression}} 73 74 int f[10]; // expected-note {{declared}} 75 [&]() { return f[2]; }; 76 (void) ^{ return []() { return f[2]; }; }; // expected-error {{variable 'f' cannot be implicitly captured in a lambda with no capture-default specified}} \ 77 // expected-note{{lambda expression begins here}} expected-note 2 {{capture 'f' by}} expected-note 2 {{default capture by}} 78 79 struct G { G(); G(G&); int a; }; // expected-note 6 {{not viable}} 80 G g; 81 [=]() { const G* gg = &g; return gg->a; }; 82 [=]() { return [=]{ const G* gg = &g; return gg->a; }(); }; // expected-error {{no matching constructor for initialization of 'G'}} 83 (void)^{ return [=]{ const G* gg = &g; return gg->a; }(); }; // expected-error 2 {{no matching constructor for initialization of 'const G'}} 84 85 const int h = a; // expected-note {{declared}} 86 []() { return h; }; // expected-error {{variable 'h' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-note 2 {{capture 'h' by}} expected-note 2 {{default capture by}} 87 88 // References can appear in constant expressions if they are initialized by 89 // reference constant expressions. 90 int i; 91 int &ref_i = i; // expected-note {{declared}} 92 [] { return ref_i; }; // expected-error {{variable 'ref_i' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-note 2 {{capture 'ref_i' by}} expected-note 2 {{default capture by}} 93 94 static int j; 95 int &ref_j = j; 96 [] { return ref_j; }; // ok 97 } 98 } 99 100 namespace SpecialMembers { 101 void f() { 102 auto a = []{}; // expected-note 2{{here}} expected-note 2{{candidate}} 103 decltype(a) b; // expected-error {{no matching constructor}} 104 decltype(a) c = a; 105 decltype(a) d = static_cast<decltype(a)&&>(a); 106 a = a; // expected-error {{copy assignment operator is implicitly deleted}} 107 a = static_cast<decltype(a)&&>(a); // expected-error {{copy assignment operator is implicitly deleted}} 108 } 109 struct P { 110 P(const P&) = delete; //expected-note {{deleted here}} // expected-cxx14-note {{deleted here}} 111 }; 112 struct Q { 113 ~Q() = delete; // expected-note {{deleted here}} 114 }; 115 struct R { 116 R(const R&) = default; 117 R(R&&) = delete; 118 R &operator=(const R&) = delete; 119 R &operator=(R&&) = delete; 120 }; 121 void g(P &p, Q &q, R &r) { 122 // FIXME: The note attached to the second error here is just amazingly bad. 123 auto pp = [p]{}; // expected-error {{deleted constructor}} expected-cxx14-error {{deleted copy constructor of '(lambda}} 124 // expected-cxx14-note-re@-1 {{copy constructor of '(lambda at {{.*}})' is implicitly deleted because field '' has a deleted copy constructor}} 125 auto qq = [q]{}; // expected-error {{deleted function}} expected-note {{because}} 126 127 auto a = [r]{}; // expected-note 2{{here}} 128 decltype(a) b = a; 129 decltype(a) c = static_cast<decltype(a)&&>(a); // ok, copies R 130 a = a; // expected-error {{copy assignment operator is implicitly deleted}} 131 a = static_cast<decltype(a)&&>(a); // expected-error {{copy assignment operator is implicitly deleted}} 132 } 133 } 134 135 namespace PR12031 { 136 struct X { 137 template<typename T> 138 X(const T&); 139 ~X(); 140 }; 141 142 void f(int i, X x); 143 void g() { 144 const int v = 10; 145 f(v, [](){}); 146 } 147 } 148 149 namespace Array { 150 int &f(int *p); 151 char &f(...); 152 void g() { 153 int n = -1; 154 [=] { 155 int arr[n]; // VLA 156 } (); 157 158 const int m = -1; 159 [] { 160 int arr[m]; // expected-error{{negative size}} 161 } (); 162 163 [&] { 164 int arr[m]; // expected-error{{negative size}} 165 } (); 166 167 [=] { 168 int arr[m]; // expected-error{{negative size}} 169 } (); 170 171 [m] { 172 int arr[m]; // expected-error{{negative size}} 173 } (); 174 } 175 } 176 177 void PR12248() 178 { 179 unsigned int result = 0; 180 auto l = [&]() { ++result; }; 181 } 182 183 namespace ModifyingCapture { 184 void test() { 185 int n = 0; 186 [=] { 187 n = 1; // expected-error {{cannot assign to a variable captured by copy in a non-mutable lambda}} 188 }; 189 } 190 } 191 192 namespace VariadicPackExpansion { 193 template<typename T, typename U> using Fst = T; 194 template<typename...Ts> bool g(Fst<bool, Ts> ...bools); 195 template<typename...Ts> bool f(Ts &&...ts) { 196 return g<Ts...>([&ts] { 197 if (!ts) 198 return false; 199 --ts; 200 return true; 201 } () ...); 202 } 203 void h() { 204 int a = 5, b = 2, c = 3; 205 while (f(a, b, c)) { 206 } 207 } 208 209 struct sink { 210 template<typename...Ts> sink(Ts &&...) {} 211 }; 212 213 template<typename...Ts> void local_class() { 214 sink { 215 [] (Ts t) { 216 struct S : Ts { 217 void f(Ts t) { 218 Ts &that = *this; 219 that = t; 220 } 221 Ts g() { return *this; }; 222 }; 223 S s; 224 s.f(t); 225 return s; 226 } (Ts()).g() ... 227 }; 228 }; 229 struct X {}; struct Y {}; 230 template void local_class<X, Y>(); 231 232 template<typename...Ts> void nested(Ts ...ts) { 233 f( 234 // Each expansion of this lambda implicitly captures all of 'ts', because 235 // the inner lambda also expands 'ts'. 236 [&] { 237 return ts + [&] { return f(ts...); } (); 238 } () ... 239 ); 240 } 241 template void nested(int, int, int); 242 243 template<typename...Ts> void nested2(Ts ...ts) { // expected-note 2{{here}} 244 // Capture all 'ts', use only one. 245 f([&ts...] { return ts; } ()...); 246 // Capture each 'ts', use it. 247 f([&ts] { return ts; } ()...); 248 // Capture all 'ts', use all of them. 249 f([&ts...] { return (int)f(ts...); } ()); 250 // Capture each 'ts', use all of them. Ill-formed. In more detail: 251 // 252 // We instantiate two lambdas here; the first captures ts$0, the second 253 // captures ts$1. Both of them reference both ts parameters, so both are 254 // ill-formed because ts can't be implicitly captured. 255 // 256 // FIXME: This diagnostic does not explain what's happening. We should 257 // specify which 'ts' we're referring to in its diagnostic name. We should 258 // also say which slice of the pack expansion is being performed in the 259 // instantiation backtrace. 260 f([&ts] { return (int)f(ts...); } ()...); // \ 261 // expected-error 2{{'ts' cannot be implicitly captured}} \ 262 // expected-note 2{{lambda expression begins here}} \ 263 // expected-note 4 {{capture 'ts' by}} \ 264 // expected-note 2 {{while substituting into a lambda}} 265 } 266 template void nested2(int); // ok 267 template void nested2(int, int); // expected-note 2 {{in instantiation of}} 268 } 269 270 namespace PR13860 { 271 void foo() { 272 auto x = PR13860UndeclaredIdentifier(); // expected-error {{use of undeclared identifier 'PR13860UndeclaredIdentifier'}} 273 auto y = [x]() { }; 274 static_assert(sizeof(y), ""); 275 } 276 } 277 278 namespace PR13854 { 279 auto l = [](void){}; 280 } 281 282 namespace PR14518 { 283 auto f = [](void) { return __func__; }; // no-warning 284 } 285 286 namespace PR16708 { 287 auto L = []() { 288 auto ret = 0; 289 return ret; 290 return 0; 291 }; 292 } 293 294 namespace TypeDeduction { 295 struct S {}; 296 void f() { 297 const S s {}; 298 S &&t = [&] { return s; } (); 299 #if __cplusplus > 201103L 300 S &&u = [&] () -> auto { return s; } (); 301 #endif 302 } 303 } 304 305 306 namespace lambdas_in_NSDMIs { 307 template<class T> 308 struct L { 309 T t{}; 310 T t2 = ([](int a) { return [](int b) { return b; };})(t)(t); 311 }; 312 L<int> l; 313 314 namespace non_template { 315 struct L { 316 int t = 0; 317 int t2 = ([](int a) { return [](int b) { return b; };})(t)(t); 318 }; 319 L l; 320 } 321 } 322 323 // PR18477: don't try to capture 'this' from an NSDMI encountered while parsing 324 // a lambda. 325 namespace NSDMIs_in_lambdas { 326 template<typename T> struct S { int a = 0; int b = a; }; 327 void f() { []() { S<int> s; }; } 328 329 auto x = []{ struct S { int n, m = n; }; }; 330 auto y = [&]{ struct S { int n, m = n; }; }; // expected-error {{non-local lambda expression cannot have a capture-default}} 331 void g() { auto z = [&]{ struct S { int n, m = n; }; }; } 332 } 333 334 namespace CaptureIncomplete { 335 struct Incomplete; // expected-note 2{{forward decl}} 336 void g(const Incomplete &a); 337 void f(Incomplete &a) { 338 (void) [a] {}; // expected-error {{incomplete}} 339 (void) [&a] {}; 340 341 (void) [=] { g(a); }; // expected-error {{incomplete}} 342 (void) [&] { f(a); }; 343 } 344 } 345 346 namespace CaptureAbstract { 347 struct S { 348 virtual void f() = 0; // expected-note {{unimplemented}} 349 int n = 0; 350 }; 351 struct T : S { 352 constexpr T() {} 353 void f(); 354 }; 355 void f() { 356 constexpr T t = T(); 357 S &s = const_cast<T&>(t); 358 // FIXME: Once we properly compute odr-use per DR712, this should be 359 // accepted (and should not capture 's'). 360 [=] { return s.n; }; // expected-error {{abstract}} 361 } 362 } 363 364 namespace PR18128 { 365 auto l = [=]{}; // expected-error {{non-local lambda expression cannot have a capture-default}} 366 367 struct S { 368 int n; 369 int (*f())[true ? 1 : ([=]{ return n; }(), 0)]; 370 // expected-error@-1 {{non-local lambda expression cannot have a capture-default}} 371 // expected-error@-2 {{invalid use of non-static data member 'n'}} 372 // expected-cxx14-error@-3 {{a lambda expression may not appear inside of a constant expression}} 373 int g(int k = ([=]{ return n; }(), 0)); 374 // expected-error@-1 {{non-local lambda expression cannot have a capture-default}} 375 // expected-error@-2 {{invalid use of non-static data member 'n'}} 376 377 int a = [=]{ return n; }(); // ok 378 int b = [=]{ return [=]{ return n; }(); }(); // ok 379 int c = []{ int k = 0; return [=]{ return k; }(); }(); // ok 380 int d = [] { return [=] { return n; }(); }(); // expected-error {{'this' cannot be implicitly captured in this context}} expected-note {{explicitly capture 'this'}} 381 }; 382 } 383 384 namespace PR18473 { 385 template<typename T> void f() { 386 T t(0); 387 (void) [=]{ int n = t; }; // expected-error {{deleted}} expected-note {{while substituting into a lambda}} 388 } 389 390 template void f<int>(); 391 struct NoCopy { 392 NoCopy(int); 393 NoCopy(const NoCopy &) = delete; // expected-note {{deleted}} 394 operator int() const; 395 }; 396 template void f<NoCopy>(); // expected-note {{instantiation}} 397 } 398 399 void PR19249() { 400 auto x = [&x]{}; // expected-error {{cannot appear in its own init}} 401 } 402 403 namespace PR20731 { 404 template <class L, int X = sizeof(L)> 405 void Job(L l); 406 407 template <typename... Args> 408 void Logger(Args &&... args) { 409 auto len = Invalid_Function((args)...); 410 // expected-error@-1 {{use of undeclared identifier 'Invalid_Function'}} 411 Job([len]() {}); 412 } 413 414 void GetMethod() { 415 Logger(); 416 // expected-note@-1 {{in instantiation of function template specialization 'PR20731::Logger<>' requested here}} 417 } 418 419 template <typename T> 420 struct A { 421 T t; 422 // expected-error@-1 {{field has incomplete type 'void'}} 423 }; 424 425 template <typename F> 426 void g(F f) { 427 auto a = A<decltype(f())>{}; 428 // expected-note@-1 {{in instantiation of template class 'PR20731::A<void>' requested here}} 429 auto xf = [a, f]() {}; 430 int x = sizeof(xf); 431 }; 432 void f() { 433 g([] {}); 434 // expected-note-re@-1 {{in instantiation of function template specialization 'PR20731::g<(lambda at {{.*}}>' requested here}} 435 } 436 437 template <class _Rp> struct function { 438 template <class _Fp> 439 function(_Fp) { 440 static_assert(sizeof(_Fp) > 0, "Type must be complete."); 441 } 442 }; 443 444 template <typename T> void p(T t) { 445 auto l = some_undefined_function(t); 446 // expected-error@-1 {{use of undeclared identifier 'some_undefined_function'}} 447 function<void()>(([l]() {})); 448 } 449 void q() { p(0); } 450 // expected-note@-1 {{in instantiation of function template specialization 'PR20731::p<int>' requested here}} 451 } 452 453 namespace lambda_in_default_mem_init { 454 template<typename T> void f() { 455 struct S { int n = []{ return 0; }(); }; 456 } 457 template void f<int>(); 458 459 template<typename T> void g() { 460 struct S { int n = [](int n){ return n; }(0); }; 461 } 462 template void g<int>(); 463 } 464 465 namespace error_in_transform_prototype { 466 template<class T> 467 void f(T t) { 468 // expected-error@+2 {{type 'int' cannot be used prior to '::' because it has no members}} 469 // expected-error@+1 {{no member named 'ns' in 'error_in_transform_prototype::S'}} 470 auto x = [](typename T::ns::type &k) {}; // expected-note 2 {{while substituting into a lambda}} 471 } 472 class S {}; 473 void foo() { 474 f(5); // expected-note {{requested here}} 475 f(S()); // expected-note {{requested here}} 476 } 477 } 478 479 namespace PR21857 { 480 template<typename Fn> struct fun : Fn { 481 fun() = default; 482 using Fn::operator(); 483 }; 484 template<typename Fn> fun<Fn> wrap(Fn fn); 485 auto x = wrap([](){}); 486 } 487 488 namespace PR13987 { 489 class Enclosing { 490 void Method(char c = []()->char { 491 int d = []()->int { 492 struct LocalClass { 493 int Method() { return 0; } 494 }; 495 return 0; 496 }(); 497 return d; }() 498 ); 499 }; 500 } 501 502 namespace PR23860 { 503 template <class> struct A { 504 void f(int x = []() { 505 struct B { 506 void g() {} 507 }; 508 return 0; 509 }()); 510 }; 511 512 int main() { 513 } 514 515 A<int> a; 516 } 517 518 namespace rdar22032373 { 519 void foo() { 520 auto blk = [](bool b) { 521 if (b) 522 return undeclared_error; // expected-error {{use of undeclared identifier}} 523 return 0; 524 }; 525 auto bar = []() { 526 return undef(); // expected-error {{use of undeclared identifier}} 527 return 0; // verify no init_conversion_failed diagnostic emitted. 528 }; 529 } 530 } 531 532 namespace nested_lambda { 533 template <int N> 534 class S {}; 535 536 void foo() { 537 const int num = 18; 538 auto outer = []() { 539 auto inner = [](S<num> &X) {}; 540 }; 541 } 542 } 543 544 namespace PR27994 { 545 struct A { template <class T> A(T); }; 546 547 template <class T> 548 struct B { 549 int x; 550 A a = [&] { int y = x; }; 551 A b = [&] { [&] { [&] { int y = x; }; }; }; 552 A d = [&](auto param) { int y = x; }; 553 A e = [&](auto param) { [&] { [&](auto param2) { int y = x; }; }; }; 554 }; 555 556 B<int> b; 557 558 template <class T> struct C { 559 struct D { 560 int x; 561 A f = [&] { int y = x; }; 562 }; 563 }; 564 565 int func() { 566 C<int> a; 567 decltype(a)::D b; 568 } 569 } 570 571 namespace PR30566 { 572 int name1; // expected-note {{'name1' declared here}} 573 574 struct S1 { 575 template<class T> 576 S1(T t) { s = sizeof(t); } 577 int s; 578 }; 579 580 void foo1() { 581 auto s0 = S1{[name=]() {}}; // expected-error 2 {{expected expression}} 582 auto s1 = S1{[name=name]() {}}; // expected-error {{use of undeclared identifier 'name'; did you mean 'name1'?}} 583 } 584 } 585 586 namespace PR25627_dont_odr_use_local_consts { 587 588 template<int> struct X {}; 589 590 void foo() { 591 const int N = 10; 592 (void) [] { X<N> x; }; 593 } 594 } 595 596 namespace ConversionOperatorDoesNotHaveDeducedReturnType { 597 auto x = [](int){}; 598 auto y = [](auto &v) -> void { v.n = 0; }; 599 using T = decltype(x); 600 using U = decltype(y); 601 using ExpectedTypeT = void (*)(int); 602 template<typename T> 603 using ExpectedTypeU = void (*)(T&); 604 605 struct X { 606 #if __cplusplus > 201402L 607 friend constexpr auto T::operator()(int) const; 608 friend constexpr T::operator ExpectedTypeT() const noexcept; 609 610 template<typename T> 611 friend constexpr void U::operator()(T&) const; 612 // FIXME: This should not match; the return type is specified as behaving 613 // "as if it were a decltype-specifier denoting the return type of 614 // [operator()]", which is not equivalent to this alias template. 615 template<typename T> 616 friend constexpr U::operator ExpectedTypeU<T>() const noexcept; 617 #else 618 friend auto T::operator()(int) const; 619 friend T::operator ExpectedTypeT() const; 620 621 template<typename T> 622 friend void U::operator()(T&) const; 623 // FIXME: This should not match, as above. 624 template<typename T> 625 friend U::operator ExpectedTypeU<T>() const; 626 #endif 627 628 private: 629 int n; 630 }; 631 632 // Should be OK: lambda's call operator is a friend. 633 void use(X &x) { y(x); } 634 635 // This used to crash in return type deduction for the conversion opreator. 636 struct A { int n; void f() { +[](decltype(n)) {}; } }; 637 } 638 639 namespace TypoCorrection { 640 template <typename T> struct X {}; 641 // expected-note@-1 {{template parameter is declared here}} 642 643 template <typename T> 644 void Run(const int& points) { 645 // expected-note@-1 {{'points' declared here}} 646 auto outer_lambda = []() { 647 auto inner_lambda = [](const X<Points>&) {}; 648 // expected-error@-1 {{use of undeclared identifier 'Points'; did you mean 'points'?}} 649 // expected-error@-2 {{template argument for template type parameter must be a type}} 650 }; 651 } 652 } 653 654 void operator_parens() { 655 [&](int x){ operator()(); }(0); // expected-error {{undeclared 'operator()'}} 656 } 657 658 namespace captured_name { 659 void Test() { 660 union { // expected-note {{'' declared here}} 661 int i; 662 }; 663 [] { return i; }; // expected-error {{variable '' cannot be implicitly captured in a lambda with no capture-default specified}} 664 // expected-note@-1 {{lambda expression begins here}} 665 // expected-note@-2 2 {{default capture by}} 666 } 667 }; 668 669 namespace GH60518 { 670 // Lambdas should not try to capture 671 // function parameters that are used in enable_if 672 struct StringLiteral { 673 template <int N> 674 StringLiteral(const char (&array)[N]) 675 __attribute__((enable_if(__builtin_strlen(array) == 2, 676 "invalid string literal"))); 677 }; 678 679 namespace cpp_attribute { 680 struct StringLiteral { 681 template <int N> 682 StringLiteral(const char (&array)[N]) [[clang::annotate_type("test", array)]]; 683 }; 684 } 685 686 void Func1() { 687 [[maybe_unused]] auto y = [&](decltype(StringLiteral("xx"))) {}; 688 [[maybe_unused]] auto z = [&](decltype(cpp_attribute::StringLiteral("xx"))) {}; 689 } 690 691 } 692 693 #if __cplusplus > 201402L 694 namespace GH60936 { 695 struct S { 696 int i; 697 // `&i` in default initializer causes implicit `this` access. 698 int *p = &i; 699 }; 700 701 static_assert([]() constexpr { 702 S r = S{2}; 703 return r.p != nullptr; 704 }()); 705 } // namespace GH60936 706 #endif 707 708 // Call operator attributes refering to a variable should 709 // be properly handled after D124351 710 constexpr int i = 2; 711 void foo() { 712 (void)[=][[gnu::aligned(i)]] () {}; // expected-warning{{C++23 extension}} 713 // CHECK: AlignedAttr 714 // CHECK-NEXT: ConstantExpr 715 // CHECK-NEXT: value: Int 2 716 } 717 718 void GH48527() { 719 auto a = []()__attribute__((b(({ return 0; })))){}; // expected-warning {{unknown attribute 'b' ignored}} 720 } 721