summaryrefslogtreecommitdiffstats
path: root/clang/test/Misc/diag-template-diffing.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2013-04-03 02:22:12 +0000
committerRichard Trieu <rtrieu@google.com>2013-04-03 02:22:12 +0000
commitad13f55356c4452631edc9b17b9dce8cac388c78 (patch)
treebb04b11f34e170564b5049aa52205b9de6ee3215 /clang/test/Misc/diag-template-diffing.cpp
parent981de5cef3ef4bf2502717bbeeaa772cdb870237 (diff)
downloadbcm5719-llvm-ad13f55356c4452631edc9b17b9dce8cac388c78.tar.gz
bcm5719-llvm-ad13f55356c4452631edc9b17b9dce8cac388c78.zip
Fix a crasher in Template Diffing.
When support was added for declaration arguments, the case of variadic declaration arguments was not supported. This patch fixes that problem by not crashing when certain ValueDecl's are null. Patch by Olivier Goffart! llvm-svn: 178610
Diffstat (limited to 'clang/test/Misc/diag-template-diffing.cpp')
-rw-r--r--clang/test/Misc/diag-template-diffing.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/clang/test/Misc/diag-template-diffing.cpp b/clang/test/Misc/diag-template-diffing.cpp
index fd331139a82..f27f8b67e2c 100644
--- a/clang/test/Misc/diag-template-diffing.cpp
+++ b/clang/test/Misc/diag-template-diffing.cpp
@@ -958,6 +958,45 @@ namespace DependentDefault {
}
}
+namespace VariadicDefault {
+ int i1, i2, i3;
+ template <int = 5, int...> struct A {};
+ template <int& = i1, int& ...> struct B {};
+ template <typename = void, typename...> struct C {};
+
+ void test() {
+ A<> a1;
+ A<5, 6, 7> a2;
+ A<1, 2> a3;
+ a2 = a1;
+ // CHECK-ELIDE-NOTREE: no viable overloaded '='
+ // CHECK-ELIDE-NOTREE: no known conversion from 'A<[...], (no argument), (no argument)>' to 'A<[...], 6, 7>'
+ a3 = a1;
+ // CHECK-ELIDE-NOTREE: no viable overloaded '='
+ // CHECK-ELIDE-NOTREE: no known conversion from 'A<(default) 5, (no argument)>' to 'A<1, 2>'
+
+ B<> b1;
+ B<i1, i2, i3> b2;
+ B<i2, i3> b3;
+ b2 = b1;
+ // CHECK-ELIDE-NOTREE: no viable overloaded '='
+ // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (no argument), (no argument)>' to 'B<[...], i2, i3>'
+ b3 = b1;
+ // CHECK-ELIDE-NOTREE: no viable overloaded '='
+ // CHECK-ELIDE-NOTREE: no known conversion from 'B<(default) i1, (no argument)>' to 'B<i2, i3>'
+
+ C<> c1;
+ C<void, void> c2;
+ C<char, char> c3;
+ c2 = c1;
+ // CHECK-ELIDE-NOTREE: no viable overloaded '='
+ // CHECK-ELIDE-NOTREE: no known conversion from 'C<[...], (no argument)>' to 'C<[...], void>'
+ c3 = c1;
+ // CHECK-ELIDE-NOTREE: no viable overloaded '='
+ // CHECK-ELIDE-NOTREE: no known conversion from 'C<(default) void, (no argument)>' to 'C<char, char>'
+ }
+}
+
// CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
// CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
// CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
OpenPOWER on IntegriCloud