]> granicus.if.org Git - clang/commitdiff
Correctly classify pack expansions as NON_CANONICAL_UNLESS_DEPENDENT
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 13 Jul 2013 21:08:08 +0000 (21:08 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 13 Jul 2013 21:08:08 +0000 (21:08 +0000)
Test coverage for non-dependent pack expansions doesn't demonstrate a
failure prior to this patch (a follow-up commit improving debug info
will cover this commit specifically) but covers a related hole in our
test coverage.

Reviewed by Richard Smith & Eli Friedman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186261 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Type.h
include/clang/AST/TypeNodes.def
lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CodeGenFunction.cpp
test/CXX/temp/temp.decls/temp.alias/p3.cpp

index 1133d126c3e0fa3d18c427dc797713df19d385c7..562243c12390015e2088a062793534aa42440b52 100644 (file)
@@ -4202,8 +4202,8 @@ public:
     return None;
   }
 
-  bool isSugared() const { return false; }
-  QualType desugar() const { return QualType(this, 0); }
+  bool isSugared() const { return !Pattern->isDependentType(); }
+  QualType desugar() const { return isSugared() ? Pattern : QualType(this, 0); }
 
   void Profile(llvm::FoldingSetNodeID &ID) {
     Profile(ID, getPattern(), getNumExpansions());
index a29ae231e94d35b9cb0dfc72d556740bdb1aef41..3126f48c644a846f945fa760a61584d59c3a4cb9 100644 (file)
@@ -99,7 +99,7 @@ TYPE(Auto, Type)
 DEPENDENT_TYPE(InjectedClassName, Type)
 DEPENDENT_TYPE(DependentName, Type)
 DEPENDENT_TYPE(DependentTemplateSpecialization, Type)
-DEPENDENT_TYPE(PackExpansion, Type)
+NON_CANONICAL_UNLESS_DEPENDENT_TYPE(PackExpansion, Type)
 TYPE(ObjCObject, Type)
 TYPE(ObjCInterface, ObjCObjectType)
 TYPE(ObjCObjectPointer, Type)
index e5fb06a7437d2a94bfd21e415e1b65f858db3b78..11149f47929e502c01147d90705401f07623a564 100644 (file)
@@ -2097,6 +2097,7 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty, llvm::DIFile Unit,
   case Type::TypeOf:
   case Type::Decltype:
   case Type::UnaryTransform:
+  case Type::PackExpansion:
     llvm_unreachable("type should have been unwrapped!");
   case Type::Auto:
     Diag = "auto";
index bea13d4269881c28a038226c3bec30e397afa797..51b86f77e59f8f278a948769fc5a42da6eab34ba 100644 (file)
@@ -1344,6 +1344,7 @@ void CodeGenFunction::EmitVariablyModifiedType(QualType type) {
     case Type::UnaryTransform:
     case Type::Attributed:
     case Type::SubstTemplateTypeParm:
+    case Type::PackExpansion:
       // Keep walking after single level desugaring.
       type = type.getSingleStepDesugaredType(getContext());
       break;
index afd9b4b0de30d719428c7596404402e4b113a351..2d46502e1d9b352d3463d56fac513789432ed23b 100644 (file)
@@ -9,5 +9,9 @@ template<class T> struct A {
 B<short> b;
 
 template<typename T> using U = int;
+
+template<typename ...T> void f(U<T> ...xs);
+void g() { f<void,void,void>(1, 2, 3); }
+
 // FIXME: This is illegal, but probably only because CWG1044 missed this paragraph.
 template<typename T> using U = U<T>;