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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [opt/] [enum1.C] - Blame information for rev 313

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

Line No. Rev Author Line
1 301 jeremybenn
// Verify that we don't confuse precision and mode for enums.
2
// { dg-do run }
3
// { dg-options "-O" }
4
 
5
extern "C" void abort();
6
 
7
enum E {
8
  zero = 0,
9
  test = 0xbb
10
};
11
 
12
static bool foo(unsigned char *x)
13
{
14
  E e = static_cast(*x);
15
  switch (e)
16
    {
17
    case test:
18
      return true;
19
    default:
20
      return false;
21
    }
22
}
23
 
24
int main()
25
{
26
  unsigned char dummy = test;
27
  if (! foo(&dummy))
28
    abort ();
29
  return 0;
30
}

powered by: WebSVN 2.1.0

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