From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BC9AC395180D; Tue, 13 Apr 2021 18:27:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC9AC395180D From: "nilsgladitz at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type Date: Tue, 13 Apr 2021 18:27:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: nilsgladitz at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 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 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, 13 Apr 2021 18:27:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99846 --- Comment #8 from Nils Gladitz --- (In reply to Jonathan Wakely from comment #5) > Now this is *obviously* wrong. The left < right expression uses the > operator< defined for the std::list base class, which depends on > comparing the list's elements, which obviously recurses. Maybe my original test case was reduced a bit too far. Recursive but bounded example which maybe is a little closer to the original case and I hope maybe a little less obviously wrong: #include #include #include struct Value; using Array =3D std::list; using Variant =3D std::variant; struct Value : Variant { using Variant::variant; }; int main() { Value left =3D Array{2, Array{}, 3}; Value right =3D Array{1}; std::cout << "<\t" << (left < right) << std::endl; std::cout << ">\t" << (left > right) << std::endl; std::cout << "=3D=3D\t" << (left =3D=3D right) << std::endl; }=