From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B8235384AB75; Tue, 30 Apr 2024 06:53:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8235384AB75 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714460037; bh=EIM8rPiF7wT/NXpuYzDFcLO2zSLFyztErDQ5NP66Lac=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Fn5oZP9Q3PbZZCIE8rKVaM5RYHNv3KC6LY/HMF6V+Mto2vOpw84cHNe6l7HP/v8zn nkKSy/aiwm6UL8WQOHznVxhm5l+AogsIo97/DU7wiGrp/kZA2/wbE13O20wS+h+7GZ NNmBGd3ZyjKQ4eqtE/+xv3LzpJH9cM89YINIwjyY= From: "de34 at live dot cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114388] Behavioral change of typeid on xvalues since GCC 9 Date: Tue, 30 Apr 2024 06:53:56 +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: de34 at live dot cn 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 #10 from Jiang An --- Broken down into two smaller examples: https://godbolt.org/z/YhK7PqE6s ``` #include #include int main() { struct B { B() {} virtual ~B() { std::puts("C++11"); } }; struct C { B b; }; typeid(C().b); // unevaluated in C++98, evaluated in C++11 } ``` https://godbolt.org/z/on76q4Mx5 ``` #include int main() { struct B { B() {} B(const B&) { std::puts("C++98"); } }; struct D : B {}; struct BB { B b; }; struct DD { D d; }; true ? BB().b : DD().d; // additional copy in C++98, no copy or move in C= ++11 } ``` CWG2887 (https://cplusplus.github.io/CWG/issues/2887.html) is related.=