From 5a6158085205887c4faf76be4f16b84a5e4b50d4 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 23 Sep 2015 13:43:16 +0000 Subject: [PATCH] [DeclPrinter] Don't crash when printing a using decl with a special name Fixes PR24872. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248376 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/DeclPrinter.cpp | 2 +- test/SemaCXX/ast-print.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index 3202d8c754..2c3cee2993 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -1299,7 +1299,7 @@ void DeclPrinter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) { if (!D->isAccessDeclaration()) Out << "using "; D->getQualifier()->print(Out, Policy); - Out << D->getName(); + Out << D->getDeclName(); } void DeclPrinter::VisitUsingShadowDecl(UsingShadowDecl *D) { diff --git a/test/SemaCXX/ast-print.cpp b/test/SemaCXX/ast-print.cpp index 1b57406a64..059804c81a 100644 --- a/test/SemaCXX/ast-print.cpp +++ b/test/SemaCXX/ast-print.cpp @@ -219,3 +219,11 @@ struct CXXFunctionalCastExprPrint {} fce = CXXFunctionalCastExprPrint{}; // CHECK: struct CXXTemporaryObjectExprPrint toe = CXXTemporaryObjectExprPrint{}; struct CXXTemporaryObjectExprPrint { CXXTemporaryObjectExprPrint(); } toe = CXXTemporaryObjectExprPrint{}; + +namespace PR24872 { +// CHECK: template struct Foo : T { +// CHECK: using T::operator-; +template struct Foo : T { + using T::operator-; +}; +} -- 2.40.0