Bug 9403 - imported namespace variables not visible
Summary: imported namespace variables not visible
Status: RESOLVED DUPLICATE of bug 7936
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.6
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 11211
  Show dependency treegraph
 
Reported: 2007-08-11 22:48 UTC by franke.daniel
Modified: 2010-01-27 19:01 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description franke.daniel 2007-08-11 22:48:01 UTC
[Converted from Gnats 2298]

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

Release:
gdb-6.6

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
Comment 1 Tom Tromey 2010-01-18 21:42:56 UTC
FWIW, this is fixed on the branch archer-keiths-expr-cumulative,
in the archer repository.
The relevant patches should be pushed into gdb cvs soon.
Comment 2 Sami Wagiaalla 2010-01-27 19:01:53 UTC

*** This bug has been marked as a duplicate of 7936 ***