[cfe-commits] r134426 - in /cfe/trunk: lib/Sema/SemaTemplateInstantiateDecl.cpp test/SemaTemplate/instantiate-function-2.cpp
Douglas Gregor
dgregor at apple.com
Tue Jul 5 11:30:26 PDT 2011
Author: dgregor
Date: Tue Jul 5 13:30:26 2011
New Revision: 134426
URL: http://llvm.org/viewvc/llvm-project?rev=134426&view=rev
Log:
Look through parenthesized declarators when determining whether an
instantiated function template was written with a prototype or via
some kind of typedef. Fixes PR10273 / <rdar://problem/9723679>.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=134426&r1=134425&r2=134426&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Jul 5 13:30:26 2011
@@ -1090,7 +1090,7 @@
Function->setLexicalDeclContext(LexicalDC);
// Attach the parameters
- if (isa<FunctionProtoType>(Function->getType())) {
+ if (isa<FunctionProtoType>(Function->getType().IgnoreParens())) {
// Adopt the already-instantiated parameters into our own context.
for (unsigned P = 0; P < Params.size(); ++P)
if (Params[P])
Modified: cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp?rev=134426&r1=134425&r2=134426&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-function-2.cpp Tue Jul 5 13:30:26 2011
@@ -56,3 +56,11 @@
int n = f<int>();
}
+
+namespace PR10273 {
+ template<typename T> void (f)(T t) {}
+
+ void g() {
+ (f)(17);
+ }
+}
More information about the cfe-commits
mailing list