------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-22
00:31 -------
One more thing, try linking in a different order and see that you get different
order of constructing of
the objects.
There is nothing we can do.
More more thing the testcase is equivent to:
#include <iostream>
class C_CHILD{
public:
C_CHILD();
C_CHILD( const char* name);
const char* m_name;
};
class C_ROOT{
public:
C_ROOT();
static C_CHILD m_variable_root;
};
C_ROOT::C_ROOT(){
std::cout<<"We needed you CTOR!"<<std::endl;
}
C_CHILD::C_CHILD(){
m_name = NULL;
}
C_CHILD::C_CHILD(const char* name){
std::cout<<"Constructor: "<<name<<std::endl;
}
class cCore {
public:
cCore();
~cCore();
static C_ROOT m_database;
};
cCore::cCore() { }
cCore::~cCore() { }
#if 1
C_CHILD C_ROOT::m_variable_root( "/" );
C_ROOT cCore::m_database;
#else
C_ROOT cCore::m_database;
C_CHILD C_ROOT::m_variable_root( "/" );
#endif
int main(){
return 0;
}
And switch the order of the two objects in the file, you will get a different
behavior, though the
requirement of that is defined IIRC but between different TU is undefined.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19123