From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13429 invoked by alias); 20 Oct 2014 13:35:29 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 13403 invoked by uid 48); 20 Oct 2014 13:35:28 -0000 From: "sivachandra at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug c++/17494] New: Ternary operator not evaluated correctly Date: Mon, 20 Oct 2014 13:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: c++ X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sivachandra at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q4/txt/msg00096.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17494 Bug ID: 17494 Summary: Ternary operator not evaluated correctly Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: c++ Assignee: unassigned at sourceware dot org Reporter: sivachandra at gmail dot com Consider the following code: class A { public: A () { a = 12345; } int geta (); int a; }; int A::geta () { return a; } int main () { A a; return 0; /* Break here */ } I see this with GDB: (gdb) p a.geta() $3 = 12345 (gdb) p false ? a.geta() : 123 $2 = {a = 12345} The result is of the wrong type (and value). Similarly: (gdb) p (true ? 123 : a.geta()) + 1 Can't do that binary op on that type -- You are receiving this mail because: You are on the CC list for the bug.