xref: /aosp_15_r20/external/clang/test/CXX/drs/dr18xx.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
2*67e74705SXin Li // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
3*67e74705SXin Li // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
4*67e74705SXin Li // RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
5*67e74705SXin Li 
6*67e74705SXin Li #if __cplusplus < 201103L
7*67e74705SXin Li // expected-no-diagnostics
8*67e74705SXin Li #endif
9*67e74705SXin Li 
dr1891()10*67e74705SXin Li void dr1891() { // dr1891: 3.6
11*67e74705SXin Li #if __cplusplus >= 201103L
12*67e74705SXin Li   int n;
13*67e74705SXin Li   auto a = []{}; // expected-note 2{{candidate}}
14*67e74705SXin Li   auto b = [=]{ return n; }; // expected-note 2{{candidate}}
15*67e74705SXin Li   typedef decltype(a) A;
16*67e74705SXin Li   typedef decltype(b) B;
17*67e74705SXin Li 
18*67e74705SXin Li   static_assert(!__has_trivial_constructor(A), "");
19*67e74705SXin Li   static_assert(!__has_trivial_constructor(B), "");
20*67e74705SXin Li 
21*67e74705SXin Li   A x; // expected-error {{no matching constructor}}
22*67e74705SXin Li   B y; // expected-error {{no matching constructor}}
23*67e74705SXin Li #endif
24*67e74705SXin Li }
25