From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19801 invoked by alias); 1 Nov 2012 07:12:20 -0000 Received: (qmail 19655 invoked by uid 48); 1 Nov 2012 07:11:58 -0000 From: "daniel.kruegler at googlemail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/25466] typeid expression fails to throw bad_typeid according to 5.2.8p2 Date: Thu, 01 Nov 2012 07:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: daniel.kruegler at googlemail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: paolo.carlini at oracle dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00014.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D25466 --- Comment #8 from Daniel Kr=C3=BCgler 2012-11-01 07:11:56 UTC --- (In reply to comment #7) The error is real. The original example belongs to 5.2.8 p2: "When typeid is applied to a **glvalue expression** whose type is a polymor= phic class type [..] " which is the rule requiring dynamic evaluation of the expression. Your coun= ter example is an expression that is an rvalue expression, which belongs to p3: "When typeid is applied to an expression other than a glvalue of a polymorp= hic class type, the result refers to a std::type_info object representing the static type of the expression. [..] The expression is an unevaluated operand (Clause 5)."