Boost C++ Libraries: Ticket #11589: Wrong initialization order when using multiple BOOST_GLOBAL_FIXTURE() https://svn.boost.org/trac10/ticket/11589 <p> 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. </p> <p> Unit Test code: </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#define BOOST_TEST_MODULE test_2_global_fixtures</span> <span class="cp">#include</span> <span class="cpf">&lt;boost/test/unit_test.hpp&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span> <span class="c1">//____________________________________________________________________________//</span> <span class="k">struct</span> <span class="n">MyConfig1</span> <span class="p">{</span> <span class="n">MyConfig1</span> <span class="p">()</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;global setup 1</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span> <span class="p">}</span> <span class="o">~</span><span class="n">MyConfig1</span> <span class="p">()</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;global teardown 1</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span> <span class="p">}</span> <span class="p">};</span> <span class="k">struct</span> <span class="n">MyConfig2</span> <span class="p">{</span> <span class="n">MyConfig2</span> <span class="p">()</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;global setup 2</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span> <span class="p">}</span> <span class="o">~</span><span class="n">MyConfig2</span> <span class="p">()</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;global teardown 2</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">;</span> <span class="p">}</span> <span class="p">};</span> <span class="c1">//____________________________________________________________________________//</span> <span class="n">BOOST_GLOBAL_FIXTURE</span> <span class="p">(</span><span class="n">MyConfig1</span><span class="p">);</span> <span class="n">BOOST_GLOBAL_FIXTURE</span> <span class="p">(</span><span class="n">MyConfig2</span><span class="p">);</span> <span class="n">BOOST_AUTO_TEST_CASE</span> <span class="p">(</span><span class="n">test_case</span><span class="p">)</span> <span class="p">{</span> <span class="n">BOOST_REQUIRE</span> <span class="p">(</span><span class="nb">true</span><span class="p">);</span> <span class="p">}</span> </pre></div></div><p> Output: </p> <pre class="wiki">global setup 2 global setup 1 Running 1 test case... global teardown 2 global teardown 1 *** No errors detected Press any key to continue . . . </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11589 Trac 1.4.3 Gennadiy Rozental Mon, 31 Aug 2015 01:04:05 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11589#comment:1 https://svn.boost.org/trac10/ticket/11589#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">obsolete</span> </li> </ul> <p> Works fine in 1.59 </p> Ticket