aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2013-04-03 02:31:17 +0000
committerRichard Trieu <rtrieu@google.com>2013-04-03 02:31:17 +0000
commit709caea14f3a31265d6a791d8e3897ca7b65c1cb (patch)
treed549a6d6b8547642b31eca467789d9016a04b555
parentfa3d2758653113cd2b5fff06f8ff22eeb669c044 (diff)
Do not assume the template argument is an integer only because the
expressions are integer. It can also be ValueDecl expressions Use the type information from the TemplateParameterList instead Patch by Olivier Goffart! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178611 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTDiagnostic.cpp3
-rw-r--r--test/Misc/diag-template-diffing.cpp5
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp
index c2c24925eb..cc1ecea9af 100644
--- a/lib/AST/ASTDiagnostic.cpp
+++ b/lib/AST/ASTDiagnostic.cpp
@@ -911,8 +911,7 @@ class TemplateDiff {
Tree.SetNode(FromExpr, ToExpr);
Tree.SetDefault(FromIter.isEnd() && FromExpr,
ToIter.isEnd() && ToExpr);
- if ((FromExpr && FromExpr->getType()->isIntegerType()) ||
- (ToExpr && ToExpr->getType()->isIntegerType())) {
+ if (DefaultNTTPD->getType()->isIntegralOrEnumerationType()) {
if (FromExpr)
FromInt = GetInt(FromIter, FromExpr);
if (ToExpr)
diff --git a/test/Misc/diag-template-diffing.cpp b/test/Misc/diag-template-diffing.cpp
index f27f8b67e2..add96efd37 100644
--- a/test/Misc/diag-template-diffing.cpp
+++ b/test/Misc/diag-template-diffing.cpp
@@ -985,6 +985,11 @@ namespace VariadicDefault {
// CHECK-ELIDE-NOTREE: no viable overloaded '='
// CHECK-ELIDE-NOTREE: no known conversion from 'B<(default) i1, (no argument)>' to 'B<i2, i3>'
+ B<i1, i2, i3> b4 = b1;
+ // CHECK-ELIDE-NOTREE: no viable conversion from 'B<[...], (no argument), (no argument)>' to 'B<[...], i2, i3>'
+ B<i2, i3> b5 = b1;
+ // CHECK-ELIDE-NOTREE: no viable conversion from 'B<(default) i1, (no argument)>' to 'B<i2, i3>'
+
C<> c1;
C<void, void> c2;
C<char, char> c3;