From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5B26E3858D35; Tue, 19 Mar 2024 11:12:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B26E3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710846752; bh=JIjwb/J5AK6d01/FWPE8IGjgqy07SyXN+k+1Fpptw/s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ux1Xv4erDRMYfI/YvUoS+9dQddts+cddZyk13y8dZ/STF3dYWZqPKhF0/oF2AUfb5 D8jwBxAEHKqXFEIktdxRKsMz5NWmqtiJEYMX2prmaTpb8+ZcJ9Qw1rQ//PzbtHcC2l ajY2Fr4bpF4IopfYA1FzVjUTZU7RvUfxC6rUwwz4= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9 Date: Tue, 19 Mar 2024 11:12:32 +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: 9.5.0 X-Bugzilla-Keywords: wrong-code 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=3D114388 --- Comment #5 from Jonathan Wakely --- Prior to DR 616 the expression (true ? WrapB().b : WrapD().d) was a prvalue= of type B, created by copying the B (or slicing the D when the condition is false). As an rvalue, it wasn't evaluated. That's true pre-N3055 and post-N3055. DR 616 changed WrapB().b to be an xvalue, and the result of the expression = is B&& in C++1 (and const B& in C++98 I guess). In C++98 the const B& is an lvalue, and in C++11 the B&& is an xvalue which= is a glvalue. Either way, it's correct to treat it as a glvalue of polymorphic type and evaluate it. So this change is not caused by N3055. And I think G++ is correct for both C++98 and C++11. So INVALID.=