]> gcc.gnu.org Git - gcc.git/commit
c++: requires-expr and access checking [PR107179]
authorPatrick Palka <ppalka@redhat.com>
Thu, 3 Nov 2022 19:35:18 +0000 (15:35 -0400)
committerPatrick Palka <ppalka@redhat.com>
Mon, 22 May 2023 03:09:27 +0000 (23:09 -0400)
commitc0658801e10d2e7e8b137e555d4c2817bf090ea9
tree181ae62f4dc28c3822486760412b379f529792ff
parentc06cb992797903b4759dd26ad28e966babdc2b17
c++: requires-expr and access checking [PR107179]

Like during satisfaction, we also need to avoid deferring access checks
during substitution of a requires-expr because the outcome of an access
check can determine the value of the requires-expr.  Otherwise (in
deferred access checking contexts such as within a base-clause), the
requires-expr may evaluate to the wrong result, and along the way a
failed access check may leak out from it into a non-SFINAE context and
cause a hard error (as in the below testcase).

PR c++/107179

gcc/cp/ChangeLog:

* constraint.cc (tsubst_requires_expr): Make sure we're not
deferring access checks.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-requires31.C: New test.

(cherry picked from commit 40c34beef620ed13c4113c893ed4335ccc1b8f92)
gcc/cp/constraint.cc
gcc/testsuite/g++.dg/cpp2a/concepts-requires31.C [new file with mode: 0644]
This page took 0.073304 seconds and 6 git commands to generate.