From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 432943858402; Tue, 21 Sep 2021 14:49:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 432943858402 From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102419] [11/12 Regression][concepts] [regression] return-type-requirement of "Y" does not check that T::type actually exists Date: Tue, 21 Sep 2021 14:49:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 14:49:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102419 Patrick Palka changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ppalka at gcc dot gnu.org --- Comment #1 from Patrick Palka --- The behavior of this testcase was changed with r11-7454 (the testcase concepts-return-req2.C added there is essentially identical to this one).=20 Before this commit, we'd substitute template arguments into the return-type-requirement before checking satisfaction, and now we substitute template arguments as part of satisfaction (into the normal form of the constraint, which is just 'true (with an empty parameter mapping)'), which explains the behavior change. AFAICT, the standard is inconsistent about whether a separate substitution should be performed here. On the one hand, [expr.prim.req.compound] says - Substitution of template arguments (if any) into the return-type-requirement is performed. which suggests a separate substitution should be performed. On the other h= and, the example in that same section says a compound-requirement is equivalent = to a simple-requirement & nested-requirement: Given concepts C and D, requires { { E1 } -> C; { E2 } -> D; }; is equivalent to requires { E1; requires C; E2; requires D; }; and we certainly shouldn't be doing a separate substitution when checking a nested-requirement. IIUC, GCC's behavior is consistent with the example. Generally GCC tries to avoid doing a separate substitution into a constraint whenever we can get away with it and instead perform the substitution as pa= rt of satisfaction. This e.g. also occurs for the type-constraint of a=20 placeholder type: template concept Y =3D true; template void f() { Y auto y =3D 0; } template void f(); // GCC accepts, Clang/MSVC reject=