]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix memclass5.C, memfriend10.C, var-templ19.C with -std=c++1z.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Dec 2015 04:34:51 +0000 (04:34 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Dec 2015 04:34:51 +0000 (04:34 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231350 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/constraint.cc
gcc/cp/cp-tree.h
gcc/cp/pt.c
gcc/cp/search.c

index 2c04ea0133be810bbe2bc97dcd99ff4cc9f3f6f8..310cdba837b5a7b22a9d6aee98887b6cfafc65eb 100644 (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.
index 71e3e0d6f1c80cf5b93f6e36e4db862f8d8531b3..89da6ecbf797155ba83024c4db8ac885716a75ba 100644 (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?
index 6ddab8a57cf9d2d59d1541187fed61bf9ede6421..1b2563d00ee00449219b1ed3590ccb6429cb3535 100644 (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);
index 6e50fcd1ee9244db47b911d90b894fb0ec36fdad..22dcee281ba5baabdb3bee6a94416f09baec3d47 100644 (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 "
index 0c11a8318cb2388287aee78e8306deaff446b9ef..05a45c3fbfb171e121d3f5187af36d882b44c001 100644 (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);