]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: use current_template_constraints more
authorPatrick Palka <ppalka@redhat.com>
Tue, 31 May 2022 12:17:21 +0000 (08:17 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 31 May 2022 12:17:21 +0000 (08:17 -0400)
gcc/cp/ChangeLog:

* decl.cc (grokvardecl): Use current_template_constraints.
(grokdeclarator): Likewise.
(xref_tag): Likewise.
* semantics.cc (finish_template_template_parm): Likewise.

gcc/cp/decl.cc
gcc/cp/semantics.cc

index 892e4a4b19b73ce0410f11a39d76e967503c0777..663a72fae15184fcf9d23359542201c1fe2c60a2 100644 (file)
@@ -10789,9 +10789,7 @@ grokvardecl (tree type,
   else if (flag_concepts
           && current_template_depth > template_class_depth (scope))
     {
-      tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
-      tree ci = build_constraints (reqs, NULL_TREE);
-
+      tree ci = current_template_constraints ();
       set_constraints (decl, ci);
     }
 
@@ -14227,9 +14225,7 @@ grokdeclarator (const cp_declarator *declarator,
                                > template_class_depth (current_class_type));
                if (memtmpl)
                  {
-                   tree tmpl_reqs
-                     = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
-                   tree ci = build_constraints (tmpl_reqs, NULL_TREE);
+                   tree ci = current_template_constraints ();
                    set_constraints (decl, ci);
                  }
              }
@@ -15852,13 +15848,8 @@ xref_tag (enum tag_types tag_code, tree name,
         {
           /* Check that we aren't trying to overload a class with different
              constraints.  */
-          tree constr = NULL_TREE;
-          if (current_template_parms)
-            {
-              tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
-              constr = build_constraints (reqs, NULL_TREE);
-            }
-         if (!redeclare_class_template (t, current_template_parms, constr))
+         if (!redeclare_class_template (t, current_template_parms,
+                                        current_template_constraints ()))
            return error_mark_node;
         }
       else if (!processing_template_decl
index 1d012d6072490016927359ff51afd77b9ff61a85..3600d270ff8d3e891b071e3a768d311f9e517259 100644 (file)
@@ -3387,8 +3387,7 @@ finish_template_template_parm (tree aggr, tree identifier)
 
   /* Associate the constraints with the underlying declaration,
      not the template.  */
-  tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
-  tree constr = build_constraints (reqs, NULL_TREE);
+  tree constr = current_template_constraints ();
   set_constraints (decl, constr);
 
   end_template_decl ();