From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CC3A93858C5E; Mon, 1 May 2023 09:43:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC3A93858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682934216; bh=+XqSv5ZXf1xXKOFy8jfFAifmichllP0ZZE1ZbP9cEyQ=; h=From:To:Subject:Date:From; b=xeaA1FHh/8yb9WbiKDAKs9GJoNdO2IG0vTshcHzjuuSc/nWHpy/wb/7tzyNM7TRwO 8xrHEzaY/1pEnfGhRvAECNZKXvq9Ftyj/P7giuevBGF02TXJRUrg+Pl7p+iTs8lpmQ VB/0fIQcToNEcTKQRzQdlwwhy1ZFRUqiL75hxLFs= From: "dani at danielbertalan dot dev" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109683] New: [13/14 Regression] False cyclic dependency error reported for constraint Date: Mon, 01 May 2023 09:43:36 +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.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dani at danielbertalan dot dev 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=3D109683 Bug ID: 109683 Summary: [13/14 Regression] False cyclic dependency error reported for constraint Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dani at danielbertalan dot dev Target Milestone: --- The following code (reduced from a custom std::variant-like type) compiles = with GCC 12.2 and Clang, but is rejected by GCC 13+: ``` template struct VariantConstructors { VariantConstructors(T&& t) requires(requires { T(t); }); }; template struct InheritFromEntries : Ts... {}; template struct InheritFromPack: InheritFromEntries... { using InheritFromEntries::InheritFromEntries...; }; template struct Variant : InheritFromPack>...> {}; template class Outer; struct Inner { Inner(Outer); }; template class Outer { Variant value_; }; struct Empty {}; void fn(Outer x) {} ``` The following compiler error is produced (arguments: -std=3Dc++20): : In instantiation of 'VariantConstructors >::VariantConstructors(T&&) requires requires{T(VariantConstructors >::__ct ::t);} [with T =3D Inner; =3D Variant]': :12:51: required from 'struct InheritFromPack >, VariantConstructors > >' :16:8: required from 'struct Variant' :25:23: required from 'class Outer' :4:25: required from 'VariantConstructors >::VariantConstructors(T&&) requires requires{T(VariantConstructors >::__ct ::t);} [with T =3D Inner; =3D Variant]' :12:51: required from 'struct InheritFromPack >, VariantConstructors > >' :16:8: required from 'struct Variant' :25:23: required from 'class Outer' :29:23: required from here :3:3: required by the constraints of 'template VariantConstructors >::VariantConstructors(T&&) requires requires{T(VariantConstructors >::__ct ::t);}' :4:14: in requirements [with T =3D Inner] :4:14: error: satisfaction of atomic constraint 'requires{T(VariantConstructors >::__ct ::t);} [with T =3D T]' depends on itself 4 | requires(requires { T(t); }); | ~^~~~~~~~~~~~~~~~~~~ Reproducer on Compiler Explorer: https://godbolt.org/z/TbcoanG5T The non-reduced preprocessed source can be found here: https://godbolt.org/z/69dMMoWKh=