[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#610535: g++: Using a global std::string in a constructor in another files generates a crashing binary



Ludovic Rousseau <rousseau@debian.org> writes:
> I found a strange bug I can't explain myself. I am not a C++ expert so
> maybe this construction is illegal.
...
> If my C++ construction is not supported by the language feel free to
> refer me to the C++ specification with details.

It looks like a bug in your program:

The initialization order of file-scope objects in different files is
undefined, and the variable "g_Application" is apparently being
initialized before the variable "foo".  So Application::Application is
called while foo is in a bogus state.

-Miles

-- 
Absurdity, n. A statement or belief manifestly inconsistent with one's own
opinion.



Reply to: