From 2ac43ad8db6e83c887af80b9c82f160599a5f66b Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 15 Nov 2013 23:00:02 +0000 Subject: PR17949: Fix crash if someone puts a namespace inside a class template. llvm-svn: 194872 --- clang/lib/Parse/ParseDeclCXX.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'clang/lib/Parse/ParseDeclCXX.cpp') 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(TagDecl)); + DiagnoseUnexpectedNamespace(cast(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(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); -- cgit v1.2.3