6638-global-init-fails-3.cpp 716 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include <boost/filesystem.hpp>
  2. #include <boost/detail/lightweight_main.hpp>
  3. #include <string>
  4. using namespace boost::filesystem;
  5. // The original bug report was that this broke:
  6. // path p(L"C:\\TEMP\\");
  7. // path r(p / "narrow");
  8. // That code now works, but ...
  9. // Nils Gladitz has provided this example ...
  10. class Test
  11. {
  12. public:
  13. ~Test()
  14. {
  15. path p(L"C:\\TEMP\\");
  16. path r(p / "narrow");
  17. }
  18. };
  19. // path p("narrow");
  20. // fails if static linked and Test object is global variable, but does not fail if
  21. // path p("narrow") line above is not commented out, and also does not fail if the
  22. // Test test2 line below is commented out.
  23. Test test1;
  24. Test test2;
  25. int cpp_main(int, char* [])
  26. {
  27. return 0;
  28. }