Fix memclass5.C, memfriend10.C, var-templ19.C with -std=c++1z.

* constraint.cc (strictly_subsumes): New.
	* cp-tree.h: Declare it.
	* pt.c (process_partial_specialization): Use it instead of
	subsumes_constraints.
	(maybe_new_partial_specialization): Do compare null constraints.
	* search.c (lookup_member): Handle currently_open_class returning null.

From-SVN: r231350
This commit is contained in:
Jason Merrill 2015-12-06 23:34:51 -05:00 committed by Jason Merrill
parent 5dc5804917
commit aabdb83166
5 changed files with 25 additions and 5 deletions

View File

@ -1,4 +1,11 @@
2015-12-05 Jason Merrill <jason@redhat.com>
2015-12-06 Jason Merrill <jason@redhat.com>
* constraint.cc (strictly_subsumes): New.
* cp-tree.h: Declare it.
* pt.c (process_partial_specialization): Use it instead of
subsumes_constraints.
(maybe_new_partial_specialization): Do compare null constraints.
* search.c (lookup_member): Handle currently_open_class returning null.
PR c++/68597, fix auto9.C and auto-neg1.C with -std=c++1z.
* decl.c (check_tag_decl): Use ds_type_spec in auto diagnostic.

View File

@ -2314,6 +2314,15 @@ subsumes_constraints (tree a, tree b)
return subsumes (a, b);
}
/* Returns true when the the constraints in A subsume those in B, but
the constraints in B do not subsume the constraints in A. */
bool
strictly_subsumes (tree a, tree b)
{
return subsumes (a, b) && !subsumes (b, a);
}
/* Determines which of the declarations, A or B, is more constrained.
That is, which declaration's constraints subsume but are not subsumed
by the other's?

View File

@ -6866,6 +6866,7 @@ extern bool constraints_satisfied_p (tree, tree);
extern bool equivalent_constraints (tree, tree);
extern bool equivalently_constrained (tree, tree);
extern bool subsumes_constraints (tree, tree);
extern bool strictly_subsumes (tree, tree);
extern int more_constrained (tree, tree);
extern void diagnose_constraints (location_t, tree, tree);

View File

@ -860,9 +860,11 @@ maybe_new_partial_specialization (tree type)
tree type_constr = current_template_constraints ();
if (type == TREE_TYPE (tmpl))
if (tree main_constr = get_constraints (tmpl))
{
tree main_constr = get_constraints (tmpl);
if (equivalent_constraints (type_constr, main_constr))
return NULL_TREE;
}
// Also, if there's a pre-existing specialization with matching
// constraints, then this also isn't new.
@ -4508,8 +4510,8 @@ process_partial_specialization (tree decl)
= TI_ARGS (get_template_info (DECL_TEMPLATE_RESULT (maintmpl)));
if (comp_template_args (inner_args, INNERMOST_TEMPLATE_ARGS (main_args))
&& (!flag_concepts
|| !subsumes_constraints (current_template_constraints (),
get_constraints (maintmpl))))
|| !strictly_subsumes (current_template_constraints (),
get_constraints (maintmpl))))
{
if (!flag_concepts)
error ("partial specialization %q+D does not specialize "

View File

@ -1271,7 +1271,8 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type,
/* Make sure we're looking for a member of the current instantiation in the
right partial specialization. */
if (flag_concepts && dependent_type_p (type))
type = currently_open_class (type);
if (tree t = currently_open_class (type))
type = t;
if (!basetype_path)
basetype_path = TYPE_BINFO (type);