diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-03-05 17:54:25 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-03-05 17:54:25 +0000 |
commit | c494f77363f057dd8619fec4e885c4f80e3d1b66 (patch) | |
tree | 736d86e0a70ccbfb484e91acd230c096955acd20 /include/clang/AST/DeclTemplate.h | |
parent | 0b4bcb639a9aab9c466a9e6d6e61b3bd1bb36d68 (diff) |
When determining template instantiation arguments within a function
template (not a specialization!), use the "injected" function template
arguments, which correspond to the template parameters of the function
template. This is required when substituting into the default template
parameters of template template parameters within a function template.
Fixes PR9016.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127092 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/DeclTemplate.h')
-rw-r--r-- | include/clang/AST/DeclTemplate.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 9c20969c1f..eaadc8132a 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -771,9 +771,20 @@ protected: /// \brief Data that is common to all of the declarations of a given /// function template. struct Common : CommonBase { + Common() : InjectedArgs(0) { } + /// \brief The function template specializations for this function /// template, including explicit specializations and instantiations. llvm::FoldingSet<FunctionTemplateSpecializationInfo> Specializations; + + /// \brief The set of "injected" template arguments used within this + /// function template. + /// + /// This pointer refers to the template arguments (there are as + /// many template arguments as template parameaters) for the function + /// template, and is allocated lazily, since most function templates do not + /// require the use of this information. + TemplateArgument *InjectedArgs; }; FunctionTemplateDecl(DeclContext *DC, SourceLocation L, DeclarationName Name, @@ -844,6 +855,15 @@ public: return makeSpecIterator(getSpecializations(), true); } + /// \brief Retrieve the "injected" template arguments that correspond to the + /// template parameters of this function template. + /// + /// Although the C++ standard has no notion of the "injected" template + /// arguments for a function template, the notion is convenient when + /// we need to perform substitutions inside the definition of a function + /// template. + std::pair<const TemplateArgument *, unsigned> getInjectedTemplateArgs(); + /// \brief Create a function template node. static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, |