------- Comment #2 from pinskia at gcc dot gnu dot org 2006-02-06 12:54 ------- foo.cc has nothing to do with the problem here. It all has to do with the order of the execution of the initializers.
The following code is enough to reproduce the issue: int mkCint(); const int cInt = mkCint(); #include <iostream> int main() { std::cout << cInt << std::endl; } int mkCint() { std::cout << "mkCint()" << std::endl; return 2; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26123