1291af2b7SDouglas Gregor // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
2*d699da42SRichard Smith // RUN: %clang_cc1 -fsyntax-only -std=c++14 %s -verify
3*d699da42SRichard Smith // RUN: %clang_cc1 -fsyntax-only -std=c++17 %s -verify
4291af2b7SDouglas Gregor 
5291af2b7SDouglas Gregor void test_nonaggregate(int i) {
680f57f68SRichard Smith   auto lambda = [i]() -> void {}; // expected-note 2{{candidate constructor}}
7291af2b7SDouglas Gregor   decltype(lambda) foo = { 1 }; // expected-error{{no matching constructor}}
8*d699da42SRichard Smith   static_assert(__is_literal(decltype(lambda)) == (__cplusplus >= 201703L), "");
9640775b4SRichard Smith 
1080f57f68SRichard Smith   auto lambda2 = []{}; // expected-note 2{{candidate constructor}}
1180f57f68SRichard Smith   decltype(lambda2) bar = {}; // expected-error{{no matching constructor}}
12*d699da42SRichard Smith   static_assert(__is_literal(decltype(lambda2)) == (__cplusplus >= 201703L), "");
13291af2b7SDouglas Gregor }
14*d699da42SRichard Smith 
15*d699da42SRichard Smith constexpr auto literal = []{};
16*d699da42SRichard Smith #if __cplusplus < 201703L
17*d699da42SRichard Smith // expected-error@-2 {{constexpr variable cannot have non-literal type}}
18*d699da42SRichard Smith // expected-note@-3 {{lambda closure types are non-literal types before C++17}}
19*d699da42SRichard Smith #endif
20