OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [constexpr-union.C] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Test that we don't have to deal with type punning
2
// DR 1188 says this is ill-formed
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" }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.