// If we get to the end of the enum-base, we hit either a '{' or a ';'.
// Don't bother checking the enumerator-list.
- if (Tok.is(tok::colon) || (AllowSemi && Tok.is(tok::semi)))
+ if (Tok.is(tok::l_brace) || (AllowSemi && Tok.is(tok::semi)))
return true;
// A second decl-specifier unambiguously indicatges an enum-base.
// be ill-formed. It cannot be an elaborated-type-specifier.
struct S {
enum : undeclared_type { v = 0 }; // expected-error {{unknown type name 'undeclared_type'}}
+ enum E : undeclared_type { w = 0 }; // expected-error {{unknown type name 'undeclared_type'}}
+ enum X : undeclared_type { x = 0 }; // expected-error {{unknown type name 'undeclared_type'}}
};
}
--- /dev/null
+// RUN: %clang_cc1 -std=c++98 -verify %s
+
+enum E {};
+enum F {};
+
+struct A {
+ // OK, this is an enumeration bit-field.
+ enum E : int(0);
+ enum F : int{0}; // expected-error {{expected '(' for function-style cast}}
+};
--- /dev/null
+// RUN: %clang_cc1 -verify -std=c++98 %s
+// expected-no-diagnostics
+
+// Objective-C allows C++11 enumerations in C++98 mode. We disambiguate in
+// order to make this a backwards-compatible extension.
+struct A {
+ enum E : int{a}; // OK, enum definition
+ enum E : int(a); // OK, bit-field declaration
+};
+_Static_assert(A::a == 0, "");