From 5cbe101b502e06d16bc77df45a27ce8bc13f33c8 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 5 Jul 2011 18:30:26 +0000 Subject: [PATCH] Look through parenthesized declarators when determining whether an instantiated function template was written with a prototype or via some kind of typedef. Fixes PR10273 / . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134426 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplateInstantiateDecl.cpp | 2 +- test/SemaTemplate/instantiate-function-2.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index b6d5abfcc8..0a05d0e304 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1090,7 +1090,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, Function->setLexicalDeclContext(LexicalDC); // Attach the parameters - if (isa(Function->getType())) { + if (isa(Function->getType().IgnoreParens())) { // Adopt the already-instantiated parameters into our own context. for (unsigned P = 0; P < Params.size(); ++P) if (Params[P]) diff --git a/test/SemaTemplate/instantiate-function-2.cpp b/test/SemaTemplate/instantiate-function-2.cpp index 21eccd4901..087ede2b89 100644 --- a/test/SemaTemplate/instantiate-function-2.cpp +++ b/test/SemaTemplate/instantiate-function-2.cpp @@ -56,3 +56,11 @@ namespace AliasTagDef { int n = f(); } + +namespace PR10273 { + template void (f)(T t) {} + + void g() { + (f)(17); + } +}