basically this reproduces the problem in a simplified setup. Especially note that we're going through a single instance of the factory, yet still this single instance 'sees' two different locations of the class static variable
36 lines
416 B
C++
36 lines
416 B
C++
|
|
#include "clang-static-init.hpp"
|
|
|
|
#include <iostream>
|
|
|
|
using std::cout;
|
|
using std::endl;
|
|
|
|
|
|
namespace test {
|
|
|
|
|
|
int Subject::cnt = 0;
|
|
|
|
Subject::Subject()
|
|
{
|
|
++cnt;
|
|
std::cout << "Subject("<<cnt<<")\n";
|
|
}
|
|
|
|
|
|
namespace {
|
|
lib::singleton::UseSubclass<Subject> typeID;
|
|
}
|
|
|
|
Factory fab(typeID);
|
|
|
|
|
|
Subject&
|
|
fabricate()
|
|
{
|
|
return fab();
|
|
}
|
|
|
|
|
|
} // namespace test
|