aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Type.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-03 17:16:23 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-03 17:16:23 +0000
commitb70126a328f89937f46db42f9e3cba1592887c91 (patch)
treed3957ff32069747c3538d9b30f6fb1d090b8bfb7 /lib/AST/Type.cpp
parent23a4ddf7875cff6ee70f6dee0d2a9956ae9b5473 (diff)
When a pack expansion occurs in the template argument list of an alias
template without a corresponding parameter pack, don't immediately substitute the alias template. This is under discussion in the C++ committee, and may become ill-formed, but for now we match GCC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r--lib/AST/Type.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 698474b838..ebf5706ed0 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1884,7 +1884,7 @@ TemplateSpecializationType(TemplateName T,
false,
Canon.isNull()? T.containsUnexpandedParameterPack()
: Canon->containsUnexpandedParameterPack()),
- Template(T), NumArgs(NumArgs) {
+ Template(T), NumArgs(NumArgs), TypeAlias(!AliasedType.isNull()) {
assert(!T.getAsDependentTemplateName() &&
"Use DependentTemplateSpecializationType for dependent template-name");
assert((T.getKind() == TemplateName::Template ||
@@ -1923,10 +1923,7 @@ TemplateSpecializationType(TemplateName T,
}
// Store the aliased type if this is a type alias template specialization.
- bool IsTypeAlias = !AliasedType.isNull();
- assert(IsTypeAlias == isTypeAlias() &&
- "allocated wrong size for type alias");
- if (IsTypeAlias) {
+ if (TypeAlias) {
TemplateArgument *Begin = reinterpret_cast<TemplateArgument *>(this + 1);
*reinterpret_cast<QualType*>(Begin + getNumArgs()) = AliasedType;
}
@@ -1943,11 +1940,6 @@ TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
Args[Idx].Profile(ID, Context);
}
-bool TemplateSpecializationType::isTypeAlias() const {
- TemplateDecl *D = Template.getAsTemplateDecl();
- return D && isa<TypeAliasTemplateDecl>(D);
-}
-
QualType
QualifierCollector::apply(const ASTContext &Context, QualType QT) const {
if (!hasNonFastQualifiers())