summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tc1/dr128.C
blob: 4dd78d57f5c3292b7c2ec5fc2868fd4746315c9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// { dg-do run }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR128: Casting between enum types

extern "C" void abort(void);

enum E1 { BLACK = 0, RED = 1 };
enum E2 { WHITE = 0, YELLOW = 1};

int main(void)
{
  E1 e1 = RED;
  E2 e2 = static_cast<E2>(e1);
  if (e2 != YELLOW)
    abort();
  return 0;
}