From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 47D0D3857B9B; Wed, 7 Jun 2023 18:41:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47D0D3857B9B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686163295; bh=nULIawPaFOqd3AHyD4NqSGo720b30ON8a6i+PBNi/Go=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BUJFwCDonyUiRX5Y2hw/ICR0RQ+w+amvvh0l98hCs/O3ZoVE6H0iLG1+2u4CIWkAi DmFv0koK4mvHuuWDrUzXdymGpXSscs74MMG65WMlVOqBZ4WF4dWZJzgiK3l+baOgjU zOIdWm4CrPeZqR+UgocP8dHWiHobASM8oCCUhalE= From: "danakj at orodu dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99599] [11/12/13/14 Regression] Concepts requirement falsely reporting cyclic dependency, breaks tag_invoke pattern Date: Wed, 07 Jun 2023 18:41:34 +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: 11.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: danakj at orodu dot net X-Bugzilla-Status: SUSPENDED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99599 --- Comment #15 from danakj at orodu dot net --- The workaround listed in Comment #6 does not work for templated types, unfortunately, making Clang and MSVC more expressive here than GCC. https://godbolt.org/z/obhsqhrbx ``` #include #include #include #if defined(__GNUC__) && !defined(__clang__) #define COMPILER_IS_GCC 1 #else #define COMPILER_IS_GCC 0 #endif namespace sus::string::__private { template A& format_to_stream(A&, B); template concept StreamCanReceiveString =3D requires(T& t, std::basic_string s= ) { { operator<<(t, s) }; }; /// Consumes the string `s` and streams it to the output stream `os`. template S> S& format_to_stream(S& os, const std::basic_string& s) { os << s; return os; } } // namespace sus::string::__private namespace sus::option { template class Option {}; using namespace ::sus::string::__private; template < class T,=20 #if COMPILER_IS_GCC std::same_as > Sus_ValueType, // Does not deduce T. ***** #endif StreamCanReceiveString Sus_StreamType > inline Sus_StreamType& operator<<( Sus_StreamType& stream, #if COMPILER_IS_GCC const Sus_ValueType& value #else const ::sus::option::Option& value // Does deduce T. **** #endif ) { return format_to_stream(stream, std::string()); } } // namespace sus::option int main() { std::stringstream s; s << sus::option::Option(); } ```=