This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/11540] New: ambiguous using reference is not error
- From: "jan dot kratochvil at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 26 Apr 2010 07:30:16 -0000
- Subject: [Bug c++/11540] New: ambiguous using reference is not error
- Reply-to: sourceware-bugzilla at sourceware dot org
namespace A { int x = 1; }
namespace B { int x = 2; }
int main (void)
{
using namespace A;
using namespace B;
return 0;
}
------------------------------------------------------------------------------
If I would use `return x;' the compiler would complain:
1.C:7: error: reference to â??xâ?? is ambiguous
1.C:2: error: candidates are: int B::x
1.C:1: error: int A::x
------------------------------------------------------------------------------
But in GDB I get:
7 return 0;
(gdb) p x
$1 = 1
and after I switch
using namespace B;
using namespace A;
I get:
(gdb) p x
$1 = 2
------------------------------------------------------------------------------
GDB thus does not have the behavior of compiler. Expecting something like:
(gdb) p x
Reference to â??xâ?? is ambiguous, candidates are `int B::x', `int A::x'.
--
Summary: ambiguous using reference is not error
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at sourceware dot org
ReportedBy: jan dot kratochvil at redhat dot com
CC: gdb-prs at sourceware dot org,swagiaal at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=11540
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.