This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/17494] New: Ternary operator not evaluated correctly
- From: "sivachandra at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 20 Oct 2014 13:35:27 +0000
- Subject: [Bug c++/17494] New: Ternary operator not evaluated correctly
- Auto-submitted: auto-generated
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.