1 // RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify %s
2 // RUN: %clang_cc1 -verify=ref %s
4 enum class EC
: short {
7 static_assert(static_cast<int>(EC::A
) == 0, "");
8 static_assert(static_cast<int>(EC::B
) == 1, "");
9 static_assert(static_cast<int>(EC::C
) == 2, "");
10 static_assert(sizeof(EC
) == sizeof(short), "");
12 constexpr EC ec
= EC::C
;
13 static_assert(static_cast<int>(ec
) == 2, "");
25 MAX
= __INT_MAX__
* 2U + 1U
27 static_assert(ONE
== -1, "");
28 static_assert(THREE
== 3, "");
29 static_assert(FIVE
== 14, "");
30 static_assert(SIX
== 16, "");
32 constexpr EC
testEnums() {
37 EC::B
= e
; // expected-error{{expression is not assignable}} \
38 // ref-error{{expression is not assignable}}
50 static_assert(getB() == EC::B
, "");
53 enum E
: bool { Zero
, One
};
54 static_assert((int)(E
)2 == 1, "");