https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107179
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:40c34beef620ed13c4113c893ed4335ccc1b8f92 commit r13-3641-g40c34beef620ed13c4113c893ed4335ccc1b8f92 Author: Patrick Palka <ppa...@redhat.com> Date: Thu Nov 3 15:35:18 2022 -0400 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.