From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B2C323858C98; Sun, 24 Dec 2023 15:04:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2C323858C98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703430278; bh=ykm4Trywmajo4YW8e2JmzrVtXMLAsyyXmOqya6spCFk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qSWkLiBZjSVtJ5PzNtOcokFGw8422pd8rb7GJ/5srOSXRcv3JVvqm9oISCtmzoWoh NfAyNEPR+iHNtQtNSRY2KJ+qQnm3mA9nWoCS+5zQFAsoc3NsyNQ0zw9a1ATVKbZ5DJ 2ntsAOaf0OAeZa1671odsCR0nl4TClhuoHmKMPtk= From: "pdimov at gmail dot com" 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:04:38 +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: pdimov at gmail 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: 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 #7 from Peter Dimov --- You don't necessarily need dynamic_cast because facets are always installed= and obtained by their exact type, not via a reference to base. You can store the Facet* as given (like shared_ptr does), and return it. The only reason dynamic_cast is needed here is because you can't static_cast 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*.=