This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/1593: Problem with nested namespaces


>Number:         1593
>Category:       c++
>Synopsis:       Problem with nested namespaces
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 23 16:48:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Klaas Gadeyne
>Release:        GNU gdb 2004-03-23-cvs
>Organization:
>Environment:
uname: tested on

Linux c014 2.6.4 #1 Mon Mar 22 13:40:45 CET 2004 i686 GNU/Linux
Linux f012 2.4.24-adeos #1 Mon Jan 26 10:44:59 CET 2004 i686 GNU/Linux


GDB

$ gdb --version
GNU gdb 2004-03-23-cvs
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".

also tested with gdb versions in debian (5.3 and 6.0)


GCC

[klaas@f012 /usr/src/rtnet-cvs/driver]$
$ g++ --version
g++ (GCC) 3.3.3 (Debian 20040320)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[klaas@f012 /usr/src/rtnet-cvs/driver]$
$ g++-3.4 --version
g++-3.4 (GCC) 3.4.0 20040320 (prerelease) (Debian)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>Description:
Consider the following code, consisting of 3 files
=========================================================================
=========================================================================
[klaas@c014 /tmp]$ cat wrapper_object.h
#include <vector>

namespace BASE
{
  class Foo
  {
  public:
    Foo(){};
    virtual ~Foo(){};
    virtual void Method();
  };

}
=========================================================================
[klaas@c014 /tmp]$ cat wrapper_object.cpp
#include "wrapper_object.h"

namespace BASE
{
  void
  Foo::Method(){};
}
==========================================================================
[klaas@c014 /tmp]$ cat wrapper.cpp
#include "wrapper_object.h"

namespace WRAPPED
{
  class Foo : public BASE::Foo
  {
  public:
    Foo() : BASE::Foo(){};
    virtual ~Foo(){};
  };
}

using namespace WRAPPED;

int main()
{
  Foo mywrapped;
  return 0;
}
==========================================================================
==========================================================================

(gdb) break wrapper.cpp:17
Breakpoint 1 at 0x80484f4: file wrapper.cpp, line 17.
(gdb) run
Starting program: /tmp/a.out

Breakpoint 1, main () at wrapper.cpp:17
17        Foo mywrapped;
(gdb) next
18        return 0;
(gdb) display mywrapped
1: mywrapped = {<> = {<No data fields>}, <No data fields>}
======================================================================

So mywrapped is now reported to be empty, where I expected to see
something like

1: mywrapped = {<Foo> = {<No data fields>}, <No data fields>}

The problem does not exist when:
- The code is compiled with g++ 2.95.4
- All code is inlined in 1 file (yes, that's why there are 3 files above :)
- I omit the member function method and put the constructor implementation
  in the cpp file.
- When Foo in namespace WRAPPED is renamed into Boo
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]