This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
c++/2298: imported namespace variables not visible
- From: franke dot daniel at gmail dot com
- To: gdb-gnats at sources dot redhat dot com
- Date: 11 Aug 2007 22:41:27 -0000
- Subject: c++/2298: imported namespace variables not visible
- Reply-to: franke dot daniel at gmail dot com
>Number: 2298
>Category: c++
>Synopsis: imported namespace variables not visible
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Aug 11 22:48:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator: franke.daniel@gmail.com
>Release: gdb-6.6
>Organization:
>Environment:
>Description:
A variable imported from a namespace is not accessible as one would expect.
While this the problem is easily circumvented in C++, it may be difficult to do with fortran. See [1] for problems to be fixed in the fortran-frontend of gcc before this might become an issue.
[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29635#c3
>How-To-Repeat:
$> cat a.cpp
#include <cstdio>
namespace foo {
int i = 42;
}
int main() {
using foo::i;
printf("%d\n", i);
return 0;
}
$> g++ -g a.cpp
$> gdb a.out
GNU gdb 6.6
[...]
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) break 10
Breakpoint 1 at 0x8048495: file a.cpp, line 10.
(gdb) run
Starting program: /home/daniel/pr/a.out
Breakpoint 1, main () at a.cpp:10
10 printf("%d\n", i);
(gdb) print i
No symbol "i" in current context.
(gdb) print foo::i
$1 = 42
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: