diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-11-15 23:00:02 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-11-15 23:00:02 +0000 |
commit | 2ac43ad8db6e83c887af80b9c82f160599a5f66b (patch) | |
tree | 6c23c952b081e02cc098ebd2245a5485dd83a6ea /clang/lib/Parse/ParseDeclCXX.cpp | |
parent | 4201ddf3686b8c6a330ee1cc5959950309968e6e (diff) | |
download | bcm5719-llvm-2ac43ad8db6e83c887af80b9c82f160599a5f66b.tar.gz bcm5719-llvm-2ac43ad8db6e83c887af80b9c82f160599a5f66b.zip |
PR17949: Fix crash if someone puts a namespace inside a class template.
llvm-svn: 194872
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 3c534f7f275..0c3eab41f90 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -2627,7 +2627,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, // If we see a namespace here, a close brace was missing somewhere. if (Tok.is(tok::kw_namespace)) { - DiagnoseUnexpectedNamespace(cast<DeclContext>(TagDecl)); + DiagnoseUnexpectedNamespace(cast<NamedDecl>(TagDecl)); break; } @@ -2722,15 +2722,15 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, ClassScope.Exit(); } -void Parser::DiagnoseUnexpectedNamespace(DeclContext *Ctx) { +void Parser::DiagnoseUnexpectedNamespace(NamedDecl *D) { assert(Tok.is(tok::kw_namespace)); // FIXME: Suggest where the close brace should have gone by looking // at indentation changes within the definition body. - Diag(cast<Decl>(Ctx)->getLocation(), - diag::err_missing_end_of_definition) << Ctx; + Diag(D->getLocation(), + diag::err_missing_end_of_definition) << D; Diag(Tok.getLocation(), - diag::note_missing_end_of_definition_before) << Ctx; + diag::note_missing_end_of_definition_before) << D; // Push '};' onto the token stream to recover. PP.EnterToken(Tok); |