This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/16463] Global variable/class method name collision
- From: "palves at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 29 Apr 2014 12:53:31 +0000
- Subject: [Bug c++/16463] Global variable/class method name collision
- Auto-submitted: auto-generated
- References: <bug-16463-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=16463
Pedro Alves <palves at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |palves at redhat dot com
--- Comment #1 from Pedro Alves <palves at redhat dot com> ---
I don't see this as "collision", but a consequence of the fact that expression
printing follows the language's scoping rules. Code inside the "global"
function wouldn't be able to refer to the "global" global without scoping
either, with:
int global (void) const { return ::global; }
We may want a way to broaden the scope, but this wouldn't be C++-specific.
E.g., the OP example seems no different to me from, say:
file1.cc:
static int foo (void) { return 1; }
int main (void) { return foo (); }
file2.cc:
int foo = 1;
and then when stopped at main, trying to print foo. It'll print the function.
Or, trying to print 'bar' from any scope, when you have:
file3.cc:
static int bar;
file4.cc:
static int bar;
(which to print?)
(The workaround in these cases is p 'file.cc'::foo)
--
You are receiving this mail because:
You are on the CC list for the bug.