From: Richard Trieu Date: Wed, 3 Apr 2013 02:31:17 +0000 (+0000) Subject: Do not assume the template argument is an integer only because the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=709caea14f3a31265d6a791d8e3897ca7b65c1cb;p=clang 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 --- 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' + B b4 = b1; + // CHECK-ELIDE-NOTREE: no viable conversion from 'B<[...], (no argument), (no argument)>' to 'B<[...], i2, i3>' + B b5 = b1; + // CHECK-ELIDE-NOTREE: no viable conversion from 'B<(default) i1, (no argument)>' to 'B' + C<> c1; C c2; C c3;