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
36 lines
435 B
C++
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
|