PR32185: Revert r291512 and add a testcase for PR32185.
This reverts an attempt to check that types match when matching a
dependently-typed non-type template parameter. (This comes up when matching the
parameters of a template template parameter against the parameters of a
template template argument.)
The matching rules here are murky at best. Our behavior after this revert is
definitely wrong for certain C++17 features (for 'auto' template parameter
types within the parameter list of a template template argument in particular),
but our behavior before this revert is wrong for some pre-existing testcases,
so reverting to our prior behavior seems like our best option.
llvm-svn: 300262
diff --git a/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
index 5eee34e..d6374e4 100644
--- a/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
+++ b/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
@@ -179,9 +179,9 @@
namespace transform_params {
template<typename T, T N, template<T (*v)[N]> typename U, T (*X)[N]>
- struct A { // expected-note 2{{candidate}}
+ struct A {
template<typename V, V M, V (*Y)[M], template<V (*v)[M]> typename W>
- A(U<X>, W<Y>); // expected-note {{[with V = int, M = 12, Y = &transform_params::n]}}
+ A(U<X>, W<Y>);
static constexpr T v = N;
};
@@ -189,9 +189,7 @@
int n[12];
template<int (*)[12]> struct Q {};
Q<&n> qn;
- // FIXME: The class template argument deduction result here is correct, but
- // we incorrectly fail to deduce arguments for the constructor!
- A a(qn, qn); // expected-error {{no matching constructor for initialization of 'transform_params::A<int, 12, Q, &transform_params::n>'}}
+ A a(qn, qn);
static_assert(a.v == 12);
template<typename ...T> struct B {
@@ -203,16 +201,12 @@
};
B b({1, 2, 3}, "foo", {'x', 'y', 'z', 'w'}); // ok
- // This should be accepted once -std=c++1z implies
- // -frelaxed-template-template-args. Without that, a template template
- // parameter 'template<int, int, int> typename' cannot bind to a template
- // template argument 'template<int...> typename'.
- template<typename ...T> struct C { // expected-note {{candidate}}
+ template<typename ...T> struct C {
template<T ...V, template<T...> typename X>
- C(X<V...>); // expected-note {{substitution failure [with T = <int, int, int>, V = <0, 1, 2>]}}
+ C(X<V...>);
};
template<int...> struct Y {};
- C c(Y<0, 1, 2>{}); // expected-error {{no viable constructor or deduction guide}}
+ C c(Y<0, 1, 2>{});
template<typename ...T> struct D {
template<T ...V> D(Y<V...>);