diff options
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 1 | ||||
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index eaac06162f7..d71b307d15b 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -10339,7 +10339,6 @@ private: // Template argument deduction ensures that we have an exact match or // compatible pointer-to-function arguments that would be adjusted by ICS. // This function template specicalization works. - Specialization = cast<FunctionDecl>(Specialization->getCanonicalDecl()); assert(S.isSameOrCompatibleFunctionType( Context.getCanonicalType(Specialization->getType()), Context.getCanonicalType(TargetFunctionType))); diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index 2aaa92c35b8..5578e066a22 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -4333,6 +4333,13 @@ TEST(HasAncestor, NonParmDependentTemplateParmVarDeclRefExpr) { declRefExpr(to(decl(hasAncestor(decl())))))); } +TEST(HasAncestor, AddressOfExplicitSpecializationFunction) { + EXPECT_TRUE(matches("template <class T> void f();\n" + "template <> void f<int>();\n" + "void (*get_f())() { return f<int>; }\n", + declRefExpr(to(decl(hasAncestor(decl())))))); +} + TEST(HasParent, MatchesAllParents) { EXPECT_TRUE(matches( "template <typename T> struct C { static void f() { 42; } };" |