c++: local_specializations and recursive constrained fn [PR103714]
authorPatrick Palka <ppalka@redhat.com>
Sun, 19 Dec 2021 17:10:16 +0000 (12:10 -0500)
committerPatrick Palka <ppalka@redhat.com>
Sun, 19 Dec 2021 17:10:16 +0000 (12:10 -0500)
commit30c286aa9377850c64aa35f5845a59d321a44be0
tree4dc86f960c6c70895553b14e5e71e5213f97747a
parentba64166bf81b6eaa6e12e1aab786f22f6605401f
c++: local_specializations and recursive constrained fn [PR103714]

Here during constraint checking for the inner call to A<0>::f<0>,
substitution into the PARM_DECL d in the atomic constraint yields the
wrong local specialization because local_specializations at this point
is nonempty, and contains specializations for the caller A<0>::f<1>.

This patch makes us call push_to_top_level during satisfaction, which'll
temporarily clear local_specializations for us.

PR c++/103714

gcc/cp/ChangeLog:

* constraint.cc (satisfy_declaration_constraints): Do
push_to_top_level and pop_from_top_level around the call to
satisfy_normalized_constraints.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-uneval5.C: New test.
gcc/cp/constraint.cc
gcc/testsuite/g++.dg/cpp2a/concepts-uneval5.C [new file with mode: 0644]