summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-12-27 02:02:09 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-12-27 02:02:09 +0000
commit01bfa68fecaf53e5d9b6e7852b7264cdc5c21210 (patch)
tree0ece6be53f5f1ca526ab820ba7a917d21d70ce81 /clang/test/SemaTemplate
parent7f8540b5e7d1dd83879bedb544b91715d544dd18 (diff)
downloadbcm5719-llvm-01bfa68fecaf53e5d9b6e7852b7264cdc5c21210.tar.gz
bcm5719-llvm-01bfa68fecaf53e5d9b6e7852b7264cdc5c21210.zip
Check and build conversion sequences for non-type template arguments in
dependent contexts when processing the template in C++11 and C++14, just like we do in C++98 and C++1z. This allows us to diagnose invalid templates earlier. llvm-svn: 290567
Diffstat (limited to 'clang/test/SemaTemplate')
-rw-r--r--clang/test/SemaTemplate/temp_arg_nontype_cxx11.cpp9
-rw-r--r--clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp2
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx11.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx11.cpp
index aa4cc8c094e..17e5253bfee 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype_cxx11.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx11.cpp
@@ -27,3 +27,12 @@ namespace CanonicalNullptr {
namespace Auto {
template<auto> struct A { }; // expected-error {{until C++1z}}
}
+
+namespace check_conversion_early {
+ struct X {};
+ template<int> struct A {};
+ template<X &x> struct A<x> {}; // expected-error {{not implicitly convertible}}
+
+ struct Y { constexpr operator int() const { return 0; } };
+ template<Y &y> struct A<y> {}; // expected-error {{depends on a template parameter of the partial specialization}}
+}
diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
index abfb0f2836e..97ecbdb3f90 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
@@ -137,7 +137,7 @@ namespace DeduceDifferentType {
struct Z { constexpr operator Y&() { return y; } } z;
constexpr Y::operator Z&() { return z; }
template<Y &> struct D {};
- template<Z &z> int d(D<z>); // expected-note {{does not have the same type}}
+ template<Z &z> int d(D<z>); // expected-note {{couldn't infer template argument 'z'}}
int d_imp = d(D<y>()); // expected-error {{no matching function}}
int d_exp = d<y>(D<y>());
}
OpenPOWER on IntegriCloud