From 53e3d6d7f00ce2efbd46e36685d011234f2efcb9 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 14 Dec 2012 19:44:11 +0000 Subject: [PATCH] Don't hit an assertion failure when calculating the __PRETTY_FUNCTION__ of a member function with parenthesized declarator. Like this test case: class Foo { const char *(baz)() { return __PRETTY_FUNCTION__; } }; llvm-svn: 170233 --- clang/lib/AST/Expr.cpp | 2 +- clang/test/CodeGenCXX/predefined-expr.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index e6171eb..d3f8ac0 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -510,7 +510,7 @@ std::string PredefinedExpr::ComputeName(IdentType IT, const Decl *CurrentDecl) { POut << ")"; if (const CXXMethodDecl *MD = dyn_cast(FD)) { - const FunctionType *FT = cast(MD->getType().getTypePtr()); + const FunctionType *FT = MD->getType()->castAs(); if (FT->isConst()) POut << " const"; if (FT->isVolatile()) diff --git a/clang/test/CodeGenCXX/predefined-expr.cpp b/clang/test/CodeGenCXX/predefined-expr.cpp index 1795ec8..24ead8f 100644 --- a/clang/test/CodeGenCXX/predefined-expr.cpp +++ b/clang/test/CodeGenCXX/predefined-expr.cpp @@ -142,7 +142,7 @@ public: printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); } - inline void inlineFunction() { + inline void (inlineFunction)() { printf("__func__ %s\n", __func__); printf("__FUNCTION__ %s\n", __FUNCTION__); printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); -- 2.7.4