summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/enum2.C
blob: 6300896cff933516e13b7ed1db93a6c4d4b433f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// PR c++/43680
// Test that we don't make excessively aggressive assumptions about what
// values an enum variable can have.
// { dg-options "-O2 -fPIC" }
// { dg-do run }

extern "C" void abort ();

enum E { A, B, C, D };

void
CheckE(const E value)
{
  long v = value;
  if (v <= D)
    abort ();
}

int main() {
  CheckE(static_cast<E>(5));
}