1// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++11 -verify -triple x86_64-apple-darwin %s 2 3enum E {}; 4 5struct Z {}; 6typedef int Integer; 7 8struct X { 9 enum E : 1; 10 enum E : Z; // expected-error{{invalid underlying type}} 11 enum E2 : int; 12 enum E3 : Integer; 13}; 14 15struct Y { 16 enum E : int(2); 17 enum E : Z(); // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'Z'}} 18}; 19 20namespace pr18587 { 21struct A { 22 enum class B { 23 C 24 }; 25}; 26const int C = 4; 27struct D { 28 A::B : C; 29}; 30} 31 32enum WithUnderlying : unsigned { wu_value }; 33struct WithUnderlyingBitfield { 34 WithUnderlying wu : 3; 35} wu = { wu_value }; 36int want_unsigned(unsigned); 37int want_unsigned(int) = delete; 38int check_enum_bitfield_promotes_correctly = want_unsigned(wu.wu); 39