From 555c9673fd8c2380bf47f41450ce932472496376 Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Thu, 26 Feb 2015 02:40:48 +0000 Subject: 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 --- clang/test/Misc/diag-template-diffing.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'clang/test/Misc/diag-template-diffing.cpp') 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 struct BoolT {}; + +template void foo(T) {} + +void test() { + BoolT X; + foo>(X); +} +// CHECK-ELIDE-NOTREE: no matching function for call to 'foo' +// CHECK-ELIDE-NOTREE: candidate function [with T = BoolArgumentBitExtended::BoolT] 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. -- cgit v1.2.3