• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
2 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
3 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
4 // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
5 
6 namespace dr1346 { // dr1346: 3.5
7   auto a(1); // expected-error 0-1{{extension}}
8   auto b(1, 2); // expected-error {{multiple expressions}} expected-error 0-1{{extension}}
9 #if __cplusplus >= 201103L
10   auto c({}); // expected-error {{parenthesized initializer list}}
11   auto d({1}); // expected-error {{parenthesized initializer list}}
12   auto e({1, 2}); // expected-error {{parenthesized initializer list}}
13 #endif
f(Ts...ts)14   template<typename...Ts> void f(Ts ...ts) { // expected-error 0-1{{extension}}
15     auto x(ts...); // expected-error {{empty}} expected-error 0-1{{extension}}
16   }
17   template void f(); // expected-note {{instantiation}}
18 
19 #if __cplusplus >= 201103L
init_capture()20   void init_capture() {
21     [a(1)] {} (); // expected-error 0-1{{extension}}
22     [b(1, 2)] {} (); // expected-error {{multiple expressions}} expected-error 0-1{{extension}}
23 #if __cplusplus >= 201103L
24     [c({})] {} (); // expected-error {{parenthesized initializer list}} expected-error 0-1{{extension}}
25     [d({1})] {} (); // expected-error {{parenthesized initializer list}} expected-error 0-1{{extension}}
26     [e({1, 2})] {} (); // expected-error {{parenthesized initializer list}} expected-error 0-1{{extension}}
27 #endif
28   }
29 #endif
30 }
31 
32 namespace dr1359 { // dr1359: 3.5
33 #if __cplusplus >= 201103L
34   union A { constexpr A() = default; };
35   union B { constexpr B() = default; int a; }; // expected-error {{not constexpr}} expected-note 2{{candidate}}
36   union C { constexpr C() = default; int a, b; }; // expected-error {{not constexpr}} expected-note 2{{candidate}}
37   struct X { constexpr X() = default; union {}; };
38   struct Y { constexpr Y() = default; union { int a; }; }; // expected-error {{not constexpr}} expected-note 2{{candidate}}
39 
40   constexpr A a = A();
41   constexpr B b = B(); // expected-error {{no matching}}
42   constexpr C c = C(); // expected-error {{no matching}}
43   constexpr X x = X();
44   constexpr Y y = Y(); // expected-error {{no matching}}
45 #endif
46 }
47