Commit a9410b4f by Jason Merrill Committed by Jason Merrill

Check that a partial specialization is more specialized.

	* pt.c (process_partial_specialization): Use
	get_partial_spec_bindings to check that the partial specialization
	is more specialized than the primary template.

From-SVN: r243868
parent a93634ba
2016-12-21 Jason Merrill <jason@redhat.com>
* pt.c (process_partial_specialization): Use
get_partial_spec_bindings to check that the partial specialization
is more specialized than the primary template.
* pt.c (convert_template_argument): Pass args to do_auto_deduction.
(mark_template_parm): Handle deducibility from type of non-type
argument here.
......
......@@ -4606,9 +4606,20 @@ process_partial_specialization (tree decl)
"primary template because it replaces multiple parameters "
"with a pack expansion");
inform (DECL_SOURCE_LOCATION (maintmpl), "primary template here");
/* Avoid crash in process_partial_specialization. */
return decl;
}
/* If we aren't in a dependent class, we can actually try deduction. */
else if (tpd.level == 1
&& !get_partial_spec_bindings (maintmpl, maintmpl, specargs))
{
if (permerror (input_location, "partial specialization %qD is not "
"more specialized than", decl))
inform (DECL_SOURCE_LOCATION (maintmpl), "primary template %qD",
maintmpl);
}
/* [temp.class.spec]
A partially specialized non-type argument expression shall not
......
......@@ -12,7 +12,7 @@ template<typename _Tp, _Tp v>
};
// Partial specialization.
template<typename _Tp, _Tp v>
template<typename _Tp, _Tp* v>
struct A3<_Tp*, v>
{
typedef _Tp* value_type;
......
......@@ -3,9 +3,9 @@
template<typename> struct A;
template<typename... T> struct A<T*...> // { dg-bogus "cannot expand" "" }
template<typename... T> struct A<T*...> // { dg-error "" }
{
struct B;
};
A<void*> a; // { dg-bogus "incomplete type" "" }
A<void*> a;
......@@ -3,6 +3,6 @@
template<typename> struct A;
template<typename... T> struct A<T...> { }; // { dg-bogus "cannot expand" "" }
template<typename... T> struct A<T...> { }; // { dg-error "" }
A<int> a; // { dg-bogus "incomplete type" "" }
A<int> a;
......@@ -14,7 +14,7 @@ template<typename T, typename T::foo V>
struct Y { };
template<typename T, typename U, U v>
struct Y<T, v> { }; // { dg-error "not deducible|U" "" { target { ! c++1z } } }
struct Y<T, v> { }; // { dg-error "" }
template<typename T, T V>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment