Known Xcode/gcc bug with anonymous namespaces?
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