LUMIERA.clone/research/clang-static-init-2.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

36 lines
435 B
C++

#include "proc/hh.hpp"
#include <iostream>
using proc::ConfigResolver;
using std::cout;
using std::endl;
namespace proc {
namespace test {
int Subject::cnt = 0;
Subject::Subject()
{
++cnt;
std::cout << "Subject("<<cnt<<")\n";
}
namespace {
Holder<Subject> fab2;
}
ConfigResolver&
fabricate()
{
return ConfigResolver::instance();
}
}} // namespace proc::test