forked from OSchip/llvm-project
Handle redundant 'typename' on base class specifications.
llvm-svn: 142937
This commit is contained in:
parent
c70ed46dda
commit
dd58d4ca8f
|
@ -252,6 +252,8 @@ def err_unexpected_typedef_ident : Error<
|
|||
def err_unexpected_scope_on_base_decltype : Error<
|
||||
"unexpected namespace scope prior to decltype">;
|
||||
def err_expected_class_name : Error<"expected class name">;
|
||||
def err_expected_class_name_not_template :
|
||||
Error<"'typename' is redundant; base classes are implicitly types">;
|
||||
def err_unspecified_vla_size_with_static : Error<
|
||||
"'static' may not be used with an unspecified variable length array size">;
|
||||
|
||||
|
|
|
@ -713,6 +713,13 @@ void Parser::ParseUnderlyingTypeSpecifier(DeclSpec &DS) {
|
|||
///
|
||||
Parser::TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &BaseLoc,
|
||||
SourceLocation &EndLocation) {
|
||||
// Ignore attempts to use typename
|
||||
if (Tok.is(tok::kw_typename)) {
|
||||
Diag(Tok, diag::err_expected_class_name_not_template)
|
||||
<< FixItHint::CreateRemoval(Tok.getLocation());
|
||||
ConsumeToken();
|
||||
}
|
||||
|
||||
// Parse optional nested-name-specifier
|
||||
CXXScopeSpec SS;
|
||||
ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false);
|
||||
|
|
|
@ -34,4 +34,7 @@ namespace PR11216 {
|
|||
struct Derived4 : :: decltype(Base()) { }; // expected-error {{unexpected namespace scope prior to decltype}}
|
||||
|
||||
struct Derived5 : PR11216:: decltype(Base()) { }; // expected-error {{unexpected namespace scope prior to decltype}}
|
||||
|
||||
template<typename T>
|
||||
struct Derived6 : typename T::foo { }; // expected-error {{'typename' is redundant; base classes are implicitly types}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue