• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Known Xcode/gcc bug with anonymous namespaces?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Known Xcode/gcc bug with anonymous namespaces?


  • Subject: Known Xcode/gcc bug with anonymous namespaces?
  • From: Paul Walmsley <email@hidden>
  • Date: Fri, 21 Jul 2006 15:21:11 +0100

I've just come across a bug with anonymous namespaces -- anyone know whether this is a known issue already?

I have two cpp files. Each one has an anonymous namespace containing a class definition. The classes have the same name but are different. eg

File1.cpp
=======
namespace {
   class UnitTestStuff {
      int x;
   };
}

void DoSomething() {
   UnitTestStuff stuff;
}

File2.cpp
==========
namespace {
   class UnitTestStuff : public SomeOtherClass {
      string z;
   };
}

void DoSomethingElse() {
   UnitTestStuff stuff;
}

-------------------------
I then had a crash that occurred in File1 because the UnitTestStuff class that was instantiated was actually the one defined in File2 which was a totally different type. Stepping into the constructor with the debugger shows that it's resolving the wrong class. I'm using the DWARF debugging format for this. I think that we never noticed this problem with Xcode 2.2. Renaming one of the classes fixes the crash, but that shouldn't be necessary as the anonymous namespace should restrict the class definitions to file scope.


Paul

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Associating icon wiht app bundle in XCode
  • Next by Date: Re: Searching the headers in Xcode (Re: [ANN] Xcode + Leopard at WWDC this year)
  • Previous by thread: RE: Associating icon wiht app bundle in XCode
  • Next by thread: Mac Intel C++ compiler and debugging in Xcode
  • Index(es):
    • Date
    • Thread