Listing L |
![]() |
![]() |
std::ostream & log() { static dependent_static< statics_log> lg; return lg; } int main() { constants_and_dependents::initialize(); // this will call log(), and will construct 'lg' // This will postpone lg's initialization until // constants_and_dependents::initialize() is called. // // But constants_and_dependents::initialize() has // **already** been called. Therefore, lg's initialization // will be postponed forever! // this line will throw! log() << "test"; }; |