aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-15 16:51:42 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-15 16:51:42 +0000
commit9eea08ba72f8b1e7faf38e43376b9157fc4a2af2 (patch)
treec70d805a8c43ba0fd59498c30392a5bfc4cff431 /lib/Sema
parent8c12506ea0e9d2500f59c9865ff05ebdbae77f49 (diff)
Slightly improved template argument deduction for use in partial
ordering, along with another test case for partial ordering of partial specializations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp13
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp3
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index 28ee7d399f..da64b55d82 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -151,7 +151,18 @@ DeduceNonTypeTemplateArgument(ASTContext &Context,
return Sema::TDK_Success;
}
- // FIXME: Compare the expressions for equality!
+ if (Deduced[NTTP->getIndex()].getKind() == TemplateArgument::Expression) {
+ // Compare the expressions for equality
+ llvm::FoldingSetNodeID ID1, ID2;
+ Deduced[NTTP->getIndex()].getAsExpr()->Profile(ID1, Context, true);
+ Value->Profile(ID2, Context, true);
+ if (ID1 == ID2)
+ return Sema::TDK_Success;
+
+ // FIXME: Fill in argument mismatch information
+ return Sema::TDK_NonDeducedMismatch;
+ }
+
return Sema::TDK_Success;
}
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 1cae45e4f8..87216a072d 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -843,6 +843,9 @@ Sema::InstantiateClassTemplateSpecialization(
return true;
}
+ if (ClassTemplateSpec->isInvalidDecl())
+ return true;
+
ClassTemplateDecl *Template = ClassTemplateSpec->getSpecializedTemplate();
CXXRecordDecl *Pattern = 0;