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.
"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
};
// Partial specialization.
-template<typename _Tp, _Tp v>
+template<typename _Tp, _Tp* v>
struct A3<_Tp*, v>
{
typedef _Tp* value_type;
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;
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;
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>