1 // RUN: %clang_cc1 -fsyntax-only -verify -Wassign-enum -Wswitch-enum -Wcovered-switch-default %s
7 enum __attribute__((enum_extensibility(closed
))) EnumClosed
{
11 enum __attribute__((enum_extensibility(open
))) EnumOpen
{
15 enum __attribute__((flag_enum
)) EnumFlag
{
19 enum __attribute__((flag_enum
,enum_extensibility(closed
))) EnumFlagClosed
{
23 enum __attribute__((flag_enum
,enum_extensibility(open
))) EnumFlagOpen
{
27 enum __attribute__((enum_extensibility(arg1
))) EnumInvalidArg
{ // expected-warning{{'enum_extensibility' attribute argument not supported: 'arg1'}}
31 // FIXME: The warning should mention that enum_extensibility takes only one argument.
32 enum __attribute__((enum_extensibility(closed
,open
))) EnumTooManyArgs
{ // expected-error{{use of undeclared identifier 'open'}}
36 enum __attribute__((enum_extensibility())) EnumTooFewArgs
{ // expected-error{{'enum_extensibility' attribute takes one argument}}
40 struct __attribute__((enum_extensibility(open
))) S
{ // expected-warning{{'enum_extensibility' attribute only applies to enums}}{
44 enum Enum t0
= 100; // expected-warning{{integer constant not in range of enumerated type}}
47 switch (t0
) { // expected-warning{{enumeration value 'A1' not handled in switch}}
49 case 16: break; // expected-warning{{case value not in enumerated type}}
55 default: break; // expected-warning{{default label in switch which covers all enumeration}}
58 enum EnumClosed t1
= 100; // expected-warning{{integer constant not in range of enumerated type}}
61 switch (t1
) { // expected-warning{{enumeration value 'B1' not handled in switch}}
63 case 16: break; // expected-warning{{case value not in enumerated type}}
69 default: break; // expected-warning{{default label in switch which covers all enumeration}}
72 enum EnumOpen t2
= 100;
75 switch (t2
) { // expected-warning{{enumeration value 'C1' not handled in switch}}
86 enum EnumFlag t3
= 5; // expected-warning{{integer constant not in range of enumerated type}}
89 switch (t3
) { // expected-warning{{enumeration value 'D1' not handled in switch}}
92 case 16: break; // expected-warning{{case value not in enumerated type}}
101 enum EnumFlagClosed t4
= 5; // expected-warning{{integer constant not in range of enumerated type}}
104 switch (t4
) { // expected-warning{{enumeration value 'E1' not handled in switch}}
107 case 16: break; // expected-warning{{case value not in enumerated type}}
116 enum EnumFlagOpen t5
= 5;
119 switch (t5
) { // expected-warning{{enumeration value 'F1' not handled in switch}}