if (Inst)
return TDK_InstantiationDepth;
- ContextRAII SavedContext(*this, FunctionTemplate->getTemplatedDecl());
-
if (CheckTemplateArgumentList(FunctionTemplate,
SourceLocation(),
ExplicitTemplateArgs,
= new (Context) TemplateArgumentList(Context, Builder, /*TakeArgs=*/true);
Info.reset(ExplicitArgumentList);
+ // Template argument deduction and the final substitution should be
+ // done in the context of the templated declaration. Explicit
+ // argument substitution, on the other hand, needs to happen in the
+ // calling context.
+ ContextRAII SavedContext(*this, FunctionTemplate->getTemplatedDecl());
+
// Instantiate the types of each of the function parameters given the
// explicitly-specified template arguments.
for (FunctionDecl::param_iterator P = Function->param_begin(),
f(0, p);
}
}
+
+// rdar://problem/8537391
+namespace test3 {
+ struct Foo {
+ template <void F(char)> static inline void foo();
+ };
+
+ class Bar {
+ template<typename T> static inline void wobble(T ch);
+
+ public:
+ static void madness() {
+ Foo::foo<wobble<char> >();
+ }
+ };
+}