]> gcc.gnu.org Git - gcc.git/commit
c++: constrained variable template issues [PR98486]
authorPatrick Palka <ppalka@redhat.com>
Thu, 16 Sep 2021 19:03:55 +0000 (15:03 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 6 Oct 2021 13:43:14 +0000 (09:43 -0400)
commit729cf2ea979f396e706625b1669087d5920b8c2a
tree99a68cad26c761007575511306d92a09f67fa009
parent59c6831682dfa8bec2b5a62bdc85739924970808
c++: constrained variable template issues [PR98486]

This fixes some issues with constrained variable templates:

  - Constraints aren't checked when explicitly specializing a variable
    template.
  - Constraints aren't attached to a static data member template at
    parse time.
  - Constraints don't get propagated when (partially) instantiating a
    static data member template, so we need to make sure to look up
    constraints using the most general template during satisfaction.

PR c++/98486

gcc/cp/ChangeLog:

* constraint.cc (get_normalized_constraints_from_decl): Always
look up constraints using the most general template.
* decl.c (grokdeclarator): Set constraints on a static data
member template.
* pt.c (determine_specialization): Check constraints on a
variable template.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-var-templ1.C: New test.
* g++.dg/cpp2a/concepts-var-templ1a.C: New test.
* g++.dg/cpp2a/concepts-var-templ1b.C: New test.

(cherry picked from commit 2e2e65a46d2674bed53afd211493876ee2b79453)
gcc/cp/constraint.cc
gcc/cp/decl.c
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp2a/concepts-var-templ1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/concepts-var-templ1a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/concepts-var-templ1b.C [new file with mode: 0644]
This page took 0.065046 seconds and 6 git commands to generate.