diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-01-19 20:10:05 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-01-19 20:10:05 +0000 |
| commit | 0231d8dac7051b6ca11813c30913f4119db225ef (patch) | |
| tree | a49a326483f116adb2c569526115e0ab1e43329b /clang/lib/AST/Decl.cpp | |
| parent | 2a67aa721f71c4adbe3248ee6a8c67e9981056ed (diff) | |
| download | bcm5719-llvm-0231d8dac7051b6ca11813c30913f4119db225ef.tar.gz bcm5719-llvm-0231d8dac7051b6ca11813c30913f4119db225ef.zip | |
Implement support for non-type template parameter packs whose type is
a pack expansion, e.g., the parameter pack Values in:
template<typename ...Types>
struct Outer {
template<Types ...Values>
struct Inner;
};
This new implementation approach introduces the notion of an
"expanded" non-type template parameter pack, for which we have already
expanded the types of the parameter pack (to, say, "int*, float*",
for Outer<int*, float*>) but have not yet expanded the values. Aside
from creating these expanded non-type template parameter packs, this
patch updates template argument checking and non-type template
parameter pack instantiation to make use of the appropriate types in
the parameter pack.
llvm-svn: 123845
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 156b8496c45..9e2e8763f85 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -133,11 +133,21 @@ getLVForTemplateParameterList(const TemplateParameterList *Params) { for (TemplateParameterList::const_iterator P = Params->begin(), PEnd = Params->end(); P != PEnd; ++P) { - if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) + if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) { + if (NTTP->isExpandedParameterPack()) { + for (unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) { + QualType T = NTTP->getExpansionType(I); + if (!T->isDependentType()) + LV = merge(LV, T->getLinkageAndVisibility()); + } + continue; + } + if (!NTTP->getType()->isDependentType()) { LV = merge(LV, NTTP->getType()->getLinkageAndVisibility()); continue; } + } if (TemplateTemplateParmDecl *TTP = dyn_cast<TemplateTemplateParmDecl>(*P)) { |

