aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-12-06 23:34:51 -0500
committerJason Merrill <jason@gcc.gnu.org>2015-12-06 23:34:51 -0500
commitaabdb83166b53a13956071f0e01f841a184340f7 (patch)
tree5f9e83453e33cd3a415991604a480c3fb9f00a73
parent5dc58049178775591a6e2dd04c9ce9cee4007dab (diff)
downloadgcc-aabdb83166b53a13956071f0e01f841a184340f7.zip
gcc-aabdb83166b53a13956071f0e01f841a184340f7.tar.gz
gcc-aabdb83166b53a13956071f0e01f841a184340f7.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/constraint.cc9
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/pt.c8
-rw-r--r--gcc/cp/search.c3
5 files changed, 25 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2c04ea0..310cdba 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 71e3e0d..89da6ec 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -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?
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 6ddab8a..1b2563d 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 6e50fcd..22dcee2 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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 "
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 0c11a83..05a45c3 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -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);