2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-type-def1.C
blob1a72950b8b1555fd14a8edacf965d0c1c8d86ac3
1 // PR c++/55250
2 // { dg-do compile { target c++11 } }
4 constexpr int Test1(int x) { enum E { y = 1 }; return x; }  // { dg-error "not a return-statement" "" { target { c++11_only } } }
6 constexpr int Test2(int x) { struct T { }; return x; }  // { dg-error "not a return-statement" "" { target { c++11_only } } }
8 constexpr int Test3(int x) { typedef enum E { y = 1 } EE; return x; }  // { dg-error "not a return-statement" "" { target { c++11_only } } }
10 constexpr int Test4(int x) { typedef struct T { } TT; return x; }  // { dg-error "not a return-statement" "" { target { c++11_only } } }
12 constexpr int Test5(int x) { using EE = enum E { y = 1 }; return x; }  // { dg-error "not a return-statement" "" { target { c++11_only } } }
14 constexpr int Test6(int x) { using TT = struct T { }; return x; }  // { dg-error "not a return-statement" "" { target { c++11_only } } }
16 struct S1
18   constexpr S1() { enum E { y = 1 }; }  // { dg-error "does not have empty body" "" { target { c++11_only } } }
21 struct S2
23   constexpr S2() { struct T { }; }  // { dg-error "does not have empty body" "" { target { c++11_only } } }
26 struct S3
28   constexpr S3() { typedef enum E { y = 1 } EE; }  // { dg-error "does not have empty body" "" { target { c++11_only } } }
31 struct S4
33   constexpr S4() { typedef struct T { } TT; }  // { dg-error "does not have empty body" "" { target { c++11_only } } }
36 struct S5
38   constexpr S5() { using EE = enum E { y = 1 }; }  // { dg-error "does not have empty body" "" { target { c++11_only } } }
41 struct S6
43   constexpr S6() { using TT = struct T { }; }  // { dg-error "does not have empty body" "" { target { c++11_only } } }