]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.dg/cpp0x/constexpr-union.C
call.c (null_ptr_cst_p): Use maybe_constant_value.
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-union.C
1 // Test that we don't have to deal with type punning
2 // FIXME Mike Miller thinks it should work
3 // { dg-options -std=c++0x }
4
5 union U
6 {
7 float f;
8 unsigned char ca[sizeof(float)];
9 };
10
11 constexpr U u = { 1.0 };
12 constexpr float f = u.f;
13 constexpr unsigned char c = u.ca[0]; // { dg-error "U::ca" }
14
15 constexpr double d = 1.0;
16 constexpr unsigned char c2 = (unsigned char&)d; // { dg-error "char. glvalue" }