diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-08-27 16:57:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-08-27 16:57:43 +0000 |
commit | d60e105e6d1624da647ef7dd35a9cf6fad1b763e (patch) | |
tree | c96598344ed8cf15681c7b8987323cf861547667 /lib/Sema/SemaDecl.cpp | |
parent | 19377389530101d583955537729e8889d487d59e (diff) |
Implement instantiation of the declarations of member function
templates within class templates, producing a member function template
of a class template specialization. If you can parse that, I'm
sorry. Example:
template<typename T>
struct X {
template<typename U> void f(T, U);
};
When we instantiate X<int>, we now instantiate the declaration
X<int>::f, which looks like this:
template<typename U> void X<int>::f(int, U);
The path this takes through
TemplateDeclInstantiator::VisitCXXMethodDecl is convoluted and
ugly, but I don't know how to improve it yet. I'm resting my hopes on
the multi-level substitution required to instantiate definitions of
nested templates, which may simplify this code as well.
More testing to come...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80252 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 5f834dc500..045c12aab5 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2534,10 +2534,11 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, if (CheckTemplateDeclScope(S, TemplateParams)) return 0; - FunctionTemplate = FunctionTemplateDecl::Create(Context, CurContext, + FunctionTemplate = FunctionTemplateDecl::Create(Context, DC, NewFD->getLocation(), Name, TemplateParams, NewFD); + FunctionTemplate->setLexicalDeclContext(CurContext); NewFD->setDescribedFunctionTemplate(FunctionTemplate); } else { // FIXME: Handle function template specializations |