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!

llvm-svn: 178611
This commit is contained in:
Richard Trieu 2013-04-03 02:31:17 +00:00
parent ad13f55356
commit bcd06c0220
2 changed files with 6 additions and 2 deletions

View File

@ -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)

View File

@ -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;