OSDN Git Service

PR c++/44157
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / cpp0x / enum_base.C
1 // { dg-options "-std=c++0x" }
2
3 typedef unsigned volatile long long uvlonglong;
4
5 enum E1 : char { };
6 enum E2 : signed const short { };
7 enum E3 : uvlonglong { };
8 enum E4 : char { 
9   val = 500 // { dg-error "too large" }
10 };
11
12 enum class E5 {
13   val = (unsigned long long)-1 // { dg-error "too large" }
14 };
15
16 typedef float Float;
17
18 enum class E6 : Float { }; // { dg-error "must be an integral type" }
19
20 static_assert (sizeof(E1) == sizeof(char), "char-sized enum");
21 static_assert (sizeof(E2) == sizeof(signed short), "short-sized enum"); 
22 static_assert (sizeof(E3) == sizeof(unsigned long long), 
23                "long long-sized enum"); 
24 static_assert (sizeof(E4) == sizeof(char), "char-sized enum");
25 static_assert (sizeof(E5) == sizeof(int), "scoped enum with int size");