111
|
1 // { dg-do compile { target c++11 } }
|
|
2
|
|
3 template<class T>
|
|
4 constexpr T value_init() { return T(); }
|
|
5
|
|
6 template<class T>
|
|
7 constexpr inline T bar(T x) { return x; }
|
|
8
|
|
9 union EmptyUnion {};
|
|
10 union Union1 { int i; };
|
|
11 union Union3 { double d; int i; char* c; };
|
|
12
|
|
13 constexpr auto u1 = value_init<EmptyUnion>();
|
|
14 constexpr auto u2 = value_init<Union1>();
|
|
15 constexpr auto u3 = value_init<Union3>();
|
|
16 constexpr auto u4 = bar(EmptyUnion{});
|
|
17 constexpr auto u5 = bar(Union1{});
|
|
18 constexpr auto u6 = bar(Union3{});
|
|
19 constexpr auto u7 = bar(u1);
|