[Boost-bugs] [Boost C++ Libraries] #11589: Wrong initialization order when using multiple BOOST_GLOBAL_FIXTURE()

Subject: [Boost-bugs] [Boost C++ Libraries] #11589: Wrong initialization order when using multiple BOOST_GLOBAL_FIXTURE()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-08-27 12:18:25


#11589: Wrong initialization order when using multiple BOOST_GLOBAL_FIXTURE()
-------------------------------------------+---------------------
 Reporter: Patxi GASCUE <patxi.gascue@…> | Owner: rogeeff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: test
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
-------------------------------------------+---------------------
 In a Unit Test, when declaring 2 global fixtures using
 BOOST_GLOBAL_FIXTURE(), if I'm right, the fixtures should be constructed
 in the order they appear in the source file and destroyed in the reverse
 order.
 When building the code below on Windows 7 (64 bits), with Visual Studio
 2013 (on debug) and running it, construction and destruction are done in
 the same order (see the output below). Note that the same code works well
 on Linux.

 Unit Test code:
 {{{
 #!cpp
 #define BOOST_TEST_MODULE test_2_global_fixtures
 #include <boost/test/unit_test.hpp>
 #include <iostream>

 //____________________________________________________________________________//

 struct MyConfig1 {
     MyConfig1 () { std::cout << "global setup 1\n"; }
     ~MyConfig1 () { std::cout << "global teardown 1\n"; }
 };
 struct MyConfig2 {
     MyConfig2 () { std::cout << "global setup 2\n"; }
     ~MyConfig2 () { std::cout << "global teardown 2\n"; }
 };
 //____________________________________________________________________________//

 BOOST_GLOBAL_FIXTURE (MyConfig1);
 BOOST_GLOBAL_FIXTURE (MyConfig2);

 BOOST_AUTO_TEST_CASE (test_case) {
     BOOST_REQUIRE (true);
 }
 }}}

 Output:
 {{{
 global setup 2
 global setup 1
 Running 1 test case...
 global teardown 2
 global teardown 1

 *** No errors detected
 Press any key to continue . . .
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11589>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC