r178611 - Do not assume the template argument is an integer only because the
Richard Trieu
rtrieu at google.com
Tue Apr 2 19:31:17 PDT 2013
Author: rtrieu
Date: Tue Apr 2 21:31:17 2013
New Revision: 178611
URL: http://llvm.org/viewvc/llvm-project?rev=178611&view=rev
Log:
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!
Modified:
cfe/trunk/lib/AST/ASTDiagnostic.cpp
cfe/trunk/test/Misc/diag-template-diffing.cpp
Modified: cfe/trunk/lib/AST/ASTDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDiagnostic.cpp?rev=178611&r1=178610&r2=178611&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDiagnostic.cpp (original)
+++ cfe/trunk/lib/AST/ASTDiagnostic.cpp Tue Apr 2 21:31:17 2013
@@ -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)
Modified: cfe/trunk/test/Misc/diag-template-diffing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-template-diffing.cpp?rev=178611&r1=178610&r2=178611&view=diff
==============================================================================
--- cfe/trunk/test/Misc/diag-template-diffing.cpp (original)
+++ cfe/trunk/test/Misc/diag-template-diffing.cpp Tue Apr 2 21:31:17 2013
@@ -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;
More information about the cfe-commits
mailing list