diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-12-19 12:10:16 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-12-19 12:10:16 -0500 |
commit | 30c286aa9377850c64aa35f5845a59d321a44be0 (patch) | |
tree | 4dc86f960c6c70895553b14e5e71e5213f97747a /gcc/cp | |
parent | ba64166bf81b6eaa6e12e1aab786f22f6605401f (diff) | |
download | gcc-30c286aa9377850c64aa35f5845a59d321a44be0.zip gcc-30c286aa9377850c64aa35f5845a59d321a44be0.tar.gz gcc-30c286aa9377850c64aa35f5845a59d321a44be0.tar.bz2 |
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.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/constraint.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 8386a7d..96fa6a7 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -3177,9 +3177,11 @@ satisfy_declaration_constraints (tree t, sat_info info) { if (!push_tinst_level (t)) return result; + push_to_top_level (); push_access_scope (t); result = satisfy_normalized_constraints (norm, args, info); pop_access_scope (t); + pop_from_top_level (); pop_tinst_level (); } @@ -3235,9 +3237,11 @@ satisfy_declaration_constraints (tree t, tree args, sat_info info) if (!push_tinst_level (t, args)) return result; tree pattern = DECL_TEMPLATE_RESULT (t); + push_to_top_level (); push_access_scope (pattern); result = satisfy_normalized_constraints (norm, args, info); pop_access_scope (pattern); + pop_from_top_level (); pop_tinst_level (); } |