summaryrefslogtreecommitdiff
path: root/test/Misc
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2015-01-24 02:48:32 +0000
committerRichard Trieu <rtrieu@google.com>2015-01-24 02:48:32 +0000
commit3f8b7f34cafbdbaabaf9279cbd707ac66b07b978 (patch)
tree76a6facea2316be49393a94941135f592f3ab332 /test/Misc
parent85a92bf87e113c3cdb4132af13eef4868037b2b7 (diff)
downloadclang-3f8b7f34cafbdbaabaf9279cbd707ac66b07b978.tar.gz
When checking the template argument list, use a copy of that list for changes
and only update the orginal list on a valid arugment list. When checking an individual expression template argument, and conversions are required, update the expression in the template argument. Since template arguments are speculatively checked, the copying of the template argument list prevents updating the template arguments when the list does not match the template. Additionally, clean up the integer checking code in the template diffing code. The code performs unneccessary conversions from APSInt to APInt. Fixes PR21758. This essentially reverts r224770 to recommits r224667 and r224668 with extra changes to prevent the template instantiation problems seen in PR22006. A test to catch the discovered problem is also added. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Misc')
-rw-r--r--test/Misc/diag-template-diffing.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Misc/diag-template-diffing.cpp b/test/Misc/diag-template-diffing.cpp
index bdd6d62fdd..9f4806f64c 100644
--- a/test/Misc/diag-template-diffing.cpp
+++ b/test/Misc/diag-template-diffing.cpp
@@ -1247,6 +1247,20 @@ template <class T> using A7 = A<(T::num)>;
// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<(T::num), (default) 0>' vs 'A<T::num, 1>')
}
+namespace TemplateArgumentImplicitConversion {
+template <int X> struct condition {};
+
+struct is_const {
+ constexpr operator int() const { return 10; }
+};
+
+using T = condition<(is_const())>;
+void foo(const T &t) {
+ T &t2 = t;
+}
+// CHECK-ELIDE-NOTREE: binding of reference to type 'condition<[...]>' to a value of type 'const condition<[...]>' drops qualifiers
+}
+
// CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
// CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
// CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.