This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

c++/2398: external name gets put in wrong namespace



>Number:         2398
>Category:       c++
>Synopsis:       external name gets put in wrong namespace
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 26 21:46:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     scott snyder
>Release:        3.0 20010326 (prerelease)
>Organization:
>Environment:
System: Linux karma 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-threads=posix --enable-long-long
>Description:

If i compile the source below and look at the generated code, i see
that the reference to the rcp::EntryRCPID constructor is said to be
in the global namespace, _not_ the rcp namespace.

If the typedef is removed, then the external reference moves back
to the rcp namespace.  Oddly, if the EntryRCPID class is made non-virtual
by removing the destructor declaration, and if i turn on debugging,
then the external name also moves back to the rcp namespace.

>How-To-Repeat:

---------------------------------------------------------------------
namespace rcp {

struct EntryRCPID
{
  EntryRCPID();
  virtual ~EntryRCPID();
};

typedef EntryRCPID                  EntryRCPID;

}

void xyzzy()
{
  rcp::EntryRCPID x;
}

---------------------------------------------------------------------


$ ./cc1plus -quiet x.cc
$ c++filt < x.s | grep EntryRCPID
        call    EntryRCPID::EntryRCPID()
        call    EntryRCPID::~EntryRCPID()

If i comment out the destructor declaration in the above and add -g
to the compilation, i get instead the following results:

$ ./cc1plus -g -quiet x.cc
$ c++filt  < x.s | grep EntryRCPID
        .stabs  "EntryRCPID:T(0,25)=s1operator=::(0,26)=#(0,25),(0,27)=&(0,25),(0,28)=*(0,25),(0,29)=&(0,25),(0,21);:rcp::EntryRCPID::operator=(rcp::EntryRCPID const&);2A.;__base_ctor::(0,30)=#(0,25),(0,21),(0,28),(0,29),(0,21);:rcp::EntryRCPID::EntryRCPID(rcp::EntryRCPID const&);2A.;__comp_ctor::(0,30):rcp::EntryRCPID::EntryRCPID(rcp::EntryRCPID const&);2A.;__base_ctor::(0,31)=#(0,25),(0,21),(0,28),(0,21);:rcp::EntryRCPID::EntryRCPID();2A.;__comp_ctor::(0,31):rcp::EntryRCPID::EntryRCPID();2A.;;",128,0,0,0
        .stabs  "EntryRCPID:Tt(0,25)",128,0,4,0
        call    rcp::EntryRCPID::EntryRCPID()


>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]