]> granicus.if.org Git - clang/commitdiff
[DeclPrinter] Don't crash when printing a using decl with a special name
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 23 Sep 2015 13:43:16 +0000 (13:43 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 23 Sep 2015 13:43:16 +0000 (13:43 +0000)
Fixes PR24872.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248376 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclPrinter.cpp
test/SemaCXX/ast-print.cpp

index 3202d8c75436dcb978298b33a0a1a6162b82b501..2c3cee29932bb713c49a7b3ae24a35fbdb22cb5f 100644 (file)
@@ -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) {
index 1b57406a64f18b51f2604ca5a30fd1706bc41fed..059804c81a9aff21e4c5bad8af78d88b39b63184 100644 (file)
@@ -219,3 +219,11 @@ struct CXXFunctionalCastExprPrint {} fce = CXXFunctionalCastExprPrint{};
 
 // CHECK: struct CXXTemporaryObjectExprPrint toe = CXXTemporaryObjectExprPrint{};
 struct CXXTemporaryObjectExprPrint { CXXTemporaryObjectExprPrint(); } toe = CXXTemporaryObjectExprPrint{};
+
+namespace PR24872 {
+// CHECK: template <typename T> struct Foo : T {
+// CHECK: using T::operator-;
+template <typename T> struct Foo : T {
+  using T::operator-;
+};
+}