summaryrefslogtreecommitdiffstats
path: root/clang/test/Misc/diag-template-diffing.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2015-02-26 02:40:48 +0000
committerRichard Trieu <rtrieu@google.com>2015-02-26 02:40:48 +0000
commit555c9673fd8c2380bf47f41450ce932472496376 (patch)
tree368e8500be701d746fb9aad53bf3cd0aed4f76d7 /clang/test/Misc/diag-template-diffing.cpp
parent99b0a9cdd7a70300cc935fe9edaa19cdcf968d24 (diff)
downloadbcm5719-llvm-555c9673fd8c2380bf47f41450ce932472496376.tar.gz
bcm5719-llvm-555c9673fd8c2380bf47f41450ce932472496376.zip
Update assumption in template diffing about integer template arguments.
Fix for PR22017. Integer template arguments are automatically bit extended to the size of the integer type. In template diffing, evaluated expressions were not having their results extending, leading to comparing two APSInt's with different widths. Apply the proper bit extending when evaluating template arguments. This mainly affected bool template arguments. llvm-svn: 230603
Diffstat (limited to 'clang/test/Misc/diag-template-diffing.cpp')
-rw-r--r--clang/test/Misc/diag-template-diffing.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Misc/diag-template-diffing.cpp b/clang/test/Misc/diag-template-diffing.cpp
index 9f4806f64c9..0f2edfb6354 100644
--- a/clang/test/Misc/diag-template-diffing.cpp
+++ b/clang/test/Misc/diag-template-diffing.cpp
@@ -1261,6 +1261,19 @@ void foo(const T &t) {
// CHECK-ELIDE-NOTREE: binding of reference to type 'condition<[...]>' to a value of type 'const condition<[...]>' drops qualifiers
}
+namespace BoolArgumentBitExtended {
+template <bool B> struct BoolT {};
+
+template <typename T> void foo(T) {}
+
+void test() {
+ BoolT<false> X;
+ foo<BoolT<true>>(X);
+}
+// CHECK-ELIDE-NOTREE: no matching function for call to 'foo'
+// CHECK-ELIDE-NOTREE: candidate function [with T = BoolArgumentBitExtended::BoolT<true>] not viable: no known conversion from 'BoolT<0>' to 'BoolT<1>' for 1st argument
+}
+
// CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
// CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
// CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
OpenPOWER on IntegriCloud