* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-48089.C
blob4574eb83ff765ebb632b226239240a45527cad12
1 // PR c++/48089
2 // { dg-do compile { target c++11 } }
4 // bang is ill-formed (diagnostic required) because its initializer is
5 // non-constant, because it uses the value of an uninitialized object.
7 // s() is ill-formed (no diagnostic required) because there is no set of
8 // arguments that would produce a constant expression.
10 // R() is well-formed because i is initialized before j.
12 struct s {
13   constexpr s() : v(v) { }
14   int v;
17 constexpr s bang;               // { dg-error "|" }
19 struct R {
20   int i,j;
21   constexpr R() : i(42),j(i) { } // { dg-bogus "" }
24 constexpr R r;                  // { dg-bogus "" }
26 // Ill-formed (no diagnostic required)
27 struct T {
28   int i;
29   constexpr int f() { return i; }
30   constexpr T(): i(0) { }
31   constexpr T(const T& t) : i(f()) { } // { dg-message "" }
34 constexpr T t1;
35 // Ill-formed (diagnostic required)
36 constexpr T t2(t1);             // { dg-message "" }
38 // Well-formed
39 struct U {
40   int i, j;
41   constexpr int f(int _i) { return _i; }
42   constexpr int g() { return i; }
43   constexpr U(): i(0), j(0) { }
44   constexpr U(const U& t) : i(f(t.i)),j(0) { } // { dg-bogus "" }
45   constexpr U(int _i) : i(_i),j(g()) { } // { dg-bogus "" }
48 constexpr U u1;
49 constexpr U u2(u1);             // { dg-bogus "" }
50 constexpr U u3(1);              // { dg-bogus "" }