lumiera_/research/clang-static-init-1.cpp
Ichthyostega cec78fdc58 bughunt: extract a call sequence leading to a strange init error with Clang
Observations:
 - the initial observation was that we get two instances of the config rules service
 - obviously this it is *not* the initialisation of a static variable accessed from
    multiple compilation units. But the access from two compilation units is crucial
 - we can exclude the effect of all other initialisation. It *is* in SingletonSubclass
 - we can exclude the effect of dynamic linking. Even two translation units
    linked statically exhibit the same problem

rebuild this test case in the research area, to be able to verify with various compilers
2013-10-06 23:17:18 +02:00

38 lines
672 B
C++

#include "lib/test/run.hpp"
#include "proc/hh.hpp"
#include "proc/config-resolver.hpp"
#include <iostream>
using proc::ConfigResolver;
using ::test::Test;
using std::cout;
using std::endl;
namespace proc {
namespace test {
class StaticInstance_test : public Test
{
virtual void
run (Arg)
{
ConfigResolver& ref1 = ConfigResolver::instance();
ConfigResolver& sub2 = fabricate();
cout << "sub1="<< &ref1 << " sub2="<< &sub2 <<"\n";
}
};
/** Register this test class... */
LAUNCHER (StaticInstance_test, "unit bug");
}} // namespace proc::test