1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
2 // RUN: %clang_cc1 -fsyntax-only -std=c++14 %s -verify
3 // RUN: %clang_cc1 -fsyntax-only -std=c++17 %s -verify
5 void test_nonaggregate(int i
) {
6 auto lambda
= [i
]() -> void {}; // expected-note 2{{candidate constructor}}
7 decltype(lambda
) foo
= { 1 }; // expected-error{{no matching constructor}}
8 static_assert(__is_literal(decltype(lambda
)) == (__cplusplus
>= 201703L), "");
10 auto lambda2
= []{}; // expected-note 2{{candidate constructor}}
11 decltype(lambda2
) bar
= {}; // expected-error{{no matching constructor}}
12 static_assert(__is_literal(decltype(lambda2
)) == (__cplusplus
>= 201703L), "");
15 constexpr auto literal
= []{};
16 #if __cplusplus < 201703L
17 // expected-error@-2 {{constexpr variable cannot have non-literal type}}
18 // expected-note@-3 {{lambda closure types are non-literal types before C++17}}