diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-06-30 13:12:36 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-06-30 13:12:36 -0400 |
commit | c28e1d288ab727de6eb493e1aa2eadf5d5eef3ab (patch) | |
tree | e345163ba2fd085640f5288911c6c2bbe91fe8f1 /gcc/testsuite/lib | |
parent | b5bb7f328d56cccfb85932ff586138e5a4ef1436 (diff) | |
download | gcc-c28e1d288ab727de6eb493e1aa2eadf5d5eef3ab.zip gcc-c28e1d288ab727de6eb493e1aa2eadf5d5eef3ab.tar.gz gcc-c28e1d288ab727de6eb493e1aa2eadf5d5eef3ab.tar.bz2 |
c++: Fix push_access_scope and introduce RAII wrapper for it
When push_access_scope is passed a TYPE_DECL for a class type (which
can happen during e.g. satisfaction), we undesirably push only the
enclosing context of the class instead of the class itself. This
causes us to mishandle e.g. testcase below due to us not entering the
scope of A before checking its constraints.
This patch adjusts push_access_scope accordingly, and introduces an
RAII wrapper for it. We make use of this wrapper right away by
replacing the only user of push_nested_class_guard with this new
wrapper, which means we can remove push_nested_class_guard (whose
functionality is basically subsumed by the new wrapper).
gcc/cp/ChangeLog:
* constraint.cc (get_normalized_constraints_from_decl): Use
push_access_scope_guard instead of push_nested_class_guard.
* cp-tree.h (struct push_nested_class_guard): Replace with ...
(struct push_access_scope_guard): ... this.
* pt.c (push_access_scope): When the argument corresponds to
a class type, push the class instead of its context.
(pop_access_scope): Adjust accordingly.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-access2.C: New test.
Diffstat (limited to 'gcc/testsuite/lib')
0 files changed, 0 insertions, 0 deletions