Using Google Test with c++11, if tests are defined across separate compilation units, is the auto-registration mechanism vulnerable to the static initialisation order fiasco?
If not, why not?
EDITED TO ADD:
Specifically: As I understand it, the standard allows the initialisation of the static members of the test classes in other compilation units to occur after entry to main().
The UnitTest::GetInstance() method guarantees that the UnitTest registry is created on first access. But what stops that first access being the invocation of the main Run() method from main(), before any tests are registered?
Perhaps the key is that they are static class members, not static free variables?
Each
TESTmacro expands into a test class with static field, which will be initialized with a call toMakeAndRegisterTestInfo()that will access tests registry in function-scoped static variable inUnitTest::GetInstance(). This variable will be initialized at first use and tests registry will correctly register tests one by one even though the order of tests registration is not defined because they are registered when corresponding static fields are initialized.