From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F0C26385357C; Wed, 24 Aug 2022 13:26:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F0C26385357C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661347603; bh=JpGeY5W4kaEBSDvSSf41PFSijHTbpOH3o5iWkqcQZrU=; h=From:To:Subject:Date:From; b=g82K0yS2kKksx/4UT30/pEEiVPT3bLSO4r9huATWFFXCQk6yt6MxyAKllvCt/K/xK aH28n1OlpMf4Ee7jDR+Omt1SdpwsBia/drGh11xzM6cZO3nCMeio1CrQCo0kDdKgCS zdLkQtAnR8CaV6/NonxQEvMLCpFC2gfw1CkR89lI= From: "jakob at schmutz dot co.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106734] New: [requires] std::same_as in compound requirements doesn't produce expected result Date: Wed, 24 Aug 2022 13:26:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakob at schmutz dot co.uk 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106734 Bug ID: 106734 Summary: [requires] std::same_as in compound requirements doesn't produce expected result Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakob at schmutz dot co.uk Target Milestone: --- On gcc version 12.2.0 (and 11.3.0) I would expect the following code ``` #include struct Bar { }; int main() { Bar bar; constexpr bool same =3D requires { { bar } -> std::same_as; }; constexpr bool conv =3D requires { { bar } -> std::convertible_to; }; if constexpr (std::same_as) { std::cout << "AS SAME" << std::endl; } if constexpr (std::is_same_v) { std::cout << "IS SAME" << std::endl; } if constexpr (same) { std::cout << "REQUIRES SAME" << std::endl; } if constexpr (conv) { std::cout << "CONVERTIBLE" << std::endl; } return 0; } ``` to return ``` AS SAME IS SAME REQUIRES SAME CONVERTIBLE ``` based on how how [compound requires](https://en.cppreference.com/w/cpp/language/requires) section reads but instead it returns ``` IS SAME REQUIRES SAME CONVERTIBLE ``` compiled with `g++ temp.cpp -std=3Dc++20` compiling with `clang++ temp.cpp -std=3Dc++20` produces the expected output=