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