Fix typo in enum-base disambiguation.
This commit is contained in:
parent
ed0a57f753
commit
2d3f5a62de
|
@ -450,7 +450,7 @@ bool Parser::isEnumBase(bool AllowSemi) {
|
|||
|
||||
// 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.
|
||||
|
|
|
@ -86,6 +86,8 @@ namespace bitfield {
|
|||
// 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'}}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// 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}}
|
||||
};
|
|
@ -0,0 +1,10 @@
|
|||
// 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, "");
|
Loading…
Reference in New Issue