]> granicus.if.org Git - clang/commitdiff
Fix a few warnings stemming from my inability to properly fill out
authorDouglas Gregor <dgregor@apple.com>
Fri, 14 Jan 2011 05:11:40 +0000 (05:11 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 14 Jan 2011 05:11:40 +0000 (05:11 +0000)
switch() statements.

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

lib/AST/ASTImporter.cpp
lib/Sema/SemaTemplateDeduction.cpp

index 60ea7d9081b5dca194ca0d0fa65655f42724acd9..7989b9f278b2e7bc40b6df7063b244278f859bb5 100644 (file)
@@ -642,6 +642,21 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
     break;
   }
 
+  case Type::SubstTemplateTypeParmPack: {
+    const SubstTemplateTypeParmPackType *Subst1
+      = cast<SubstTemplateTypeParmPackType>(T1);
+    const SubstTemplateTypeParmPackType *Subst2
+      = cast<SubstTemplateTypeParmPackType>(T2);
+    if (!IsStructurallyEquivalent(Context,
+                                  QualType(Subst1->getReplacedParameter(), 0),
+                                  QualType(Subst2->getReplacedParameter(), 0)))
+      return false;
+    if (!IsStructurallyEquivalent(Context, 
+                                  Subst1->getArgumentPack(),
+                                  Subst2->getArgumentPack()))
+      return false;
+    break;
+  }
   case Type::TemplateSpecialization: {
     const TemplateSpecializationType *Spec1
       = cast<TemplateSpecializationType>(T1);
index ff769921f4dbd8f92bc43a252f3a289700ae1738..c03a778a650758fe52d3025f531ce8f911f424fc 100644 (file)
@@ -950,6 +950,13 @@ DeduceTemplateArguments(Sema &S,
   Info.FirstArg = TemplateArgument(ParamIn);
   Info.SecondArg = TemplateArgument(ArgIn);
 
+  // If the parameter is an already-substituted template parameter
+  // pack, do nothing: we don't know which of its arguments to look
+  // at, so we have to wait until all of the parameter packs in this
+  // expansion have arguments.
+  if (isa<SubstTemplateTypeParmPackType>(Param))
+    return Sema::TDK_Success;
+
   // Check the cv-qualifiers on the parameter and argument types.
   if (!(TDF & TDF_IgnoreQualifiers)) {
     if (TDF & TDF_ParamWithReferenceType) {
@@ -3527,6 +3534,17 @@ MarkUsedTemplateParameters(Sema &SemaRef, QualType T,
     break;
   }
 
+  case Type::SubstTemplateTypeParmPack: {
+    const SubstTemplateTypeParmPackType *Subst
+      = cast<SubstTemplateTypeParmPackType>(T);
+    MarkUsedTemplateParameters(SemaRef, 
+                               QualType(Subst->getReplacedParameter(), 0),
+                               OnlyDeduced, Depth, Used);
+    MarkUsedTemplateParameters(SemaRef, Subst->getArgumentPack(),
+                               OnlyDeduced, Depth, Used);
+    break;
+  }
+
   case Type::InjectedClassName:
     T = cast<InjectedClassNameType>(T)->getInjectedSpecializationType();
     // fall through