From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5E13A3858417; Mon, 18 Dec 2023 21:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E13A3858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702934210; bh=/2nxHonQ8Cw/xbSpJfPYYvUCXxERBahU7keJDI5Xbpk=; h=From:To:Subject:Date:From; b=RR3sLtr4/vc8GuET+Q6RnVDOFv3rFNsTZ9REeQ2OH0e1NgyDkZm5WX9Zo1N0HlL0q Jf8aQbCIJqN5DIUP+VMOtu7Igc26oayh+odtyXyuKHCxKR3KPDNv26n20bB4zr6XR7 klf3TqEMVK/OLZmmaprp8wianZgA2Lqah69RLcIs= From: "jdapena at igalia dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113074] New: requires requires should be SFINAE Date: Mon, 18 Dec 2023 21:16:49 +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: 13.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jdapena at igalia dot com 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 attachments.created 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=3D113074 Bug ID: 113074 Summary: requires requires should be SFINAE Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jdapena at igalia dot com Target Milestone: --- Created attachment 56904 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D56904&action=3Dedit Test case from godbolt Calling std::to_address in a requires requires function should be SFINAE. Instead of it, it fails to compile. This is breaking GCC build of Chromium in https://chromium.googlesource.com/chromium/src.git/+/refs/tags/122.0.6193.2= /mojo/public/cpp/bindings/type_converter.h#98 when the type does not support std::to_address because it fails to find operator->. Code is: template requires requires(const U& obj) { not std::is_pointer_v; { mojo::ConvertTo(std::to_address(obj)) } -> std::same_as; } inline T ConvertTo(const U& obj) { return mojo::ConvertTo(std::to_address(obj)); } The code is designed to only declare ConvertTo in case it can convert from std::to_address result. A possible test case is attached. This case fails in Clang with the expected outcome (it fails to resolve to a valid call).=