diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-05 18:58:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-05 18:58:31 +0000 |
commit | e4ff4b56fe4bdc051af4ef808ebbbff129bfa804 (patch) | |
tree | f8681c6ca5e9ea651274587fb29a82ad0ab8e7b8 /clang/lib/Sema/SemaTemplate.cpp | |
parent | dc4e9637acf1d13ee931c6cb976dba8ffb70ffe6 (diff) | |
download | bcm5719-llvm-e4ff4b56fe4bdc051af4ef808ebbbff129bfa804.tar.gz bcm5719-llvm-e4ff4b56fe4bdc051af4ef808ebbbff129bfa804.zip |
Replace the representation of template template argument pack
expansions with something that is easier to use correctly: a new
template argment kind, rather than a bit on an existing kind. Update
all of the switch statements that deal with template arguments, fixing
a few latent bugs in the process. I"m happy with this representation,
now.
And, oh look! Template instantiation and deduction work for template
template argument pack expansions.
llvm-svn: 122896
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 9adcf1c81fd..2c9a4307ed5 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2256,10 +2256,12 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, break; case TemplateArgument::Template: + case TemplateArgument::TemplateExpansion: // We were given a template template argument. It may not be ill-formed; // see below. if (DependentTemplateName *DTN - = Arg.getArgument().getAsTemplate().getAsDependentTemplateName()) { + = Arg.getArgument().getAsTemplateOrTemplatePattern() + .getAsDependentTemplateName()) { // We have a template argument such as \c T::template X, which we // parsed as a template template argument. However, since we now // know that we need a non-type template argument, convert this @@ -2273,6 +2275,17 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, Arg.getTemplateQualifierRange(), NameInfo); + // If we parsed the template argument as a pack expansion, create a + // pack expansion expression. + if (Arg.getArgument().getKind() == TemplateArgument::TemplateExpansion){ + ExprResult Expansion = ActOnPackExpansion(E, + Arg.getTemplateEllipsisLoc()); + if (Expansion.isInvalid()) + return true; + + E = Expansion.get(); + } + TemplateArgument Result; if (CheckTemplateArgument(NTTP, NTTPType, E, Result)) return true; @@ -2348,6 +2361,7 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, return true; case TemplateArgument::Template: + case TemplateArgument::TemplateExpansion: if (CheckTemplateArgument(TempParm, Arg)) return true; |