From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CA6963858C20; Sun, 24 Dec 2023 15:27:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA6963858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703431629; bh=bQx7ls75Xnb7oqfla4HQpEm2C5Ju6e0uKVMfhIYqjNU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=G9IxO1HhSyCUXqLc9LaBEIwESsM/NTsRy+yPuLUsAq5NnY7TQcA4fkxYAc68ZT5Wu dfRl4HBjuT5vnl5lRu70L6dXfi9gbjV7jW37SFuLh9WjJ4PiudlndNNXPi89i5CgwY GV7cgU7OXQPvNgVYAGDbLRBQ3FlFNzvOuHVl1s3c= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/113099] locale without RTTI uses dynamic_cast before gcc 13.2 or has ODR violation since gcc 13.2 Date: Sun, 24 Dec 2023 15:27:09 +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.4.0 X-Bugzilla-Keywords: ABI, documentation X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org 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: 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=3D113099 --- Comment #8 from Jonathan Wakely --- (In reply to Peter Dimov from comment #7) > You don't necessarily need dynamic_cast because facets are always install= ed > and obtained by their exact type, not via a reference to base. Is that true? std::use_facet will return a reference to a facet with X::= id but it could actually be something derived from X. e.g. a user can install their own facet derived from std::ctype, which overrides some members. Code that does std::use_facet>(loc) will get the user's fa= cet, but via reference to base. > You can store > the Facet* as given (like shared_ptr does), and return it. >=20 > The only reason dynamic_cast is needed here is because you can't static_c= ast > from facet* to Facet* when virtual inheritance. But you are not required = to > store facet* in the actual container; you can store the original Facet* as > void*. An implementation could do that, but I don't think libstdc++ can do it now without an ABI change.=