https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66666
--- Comment #4 from Antonio Poggiali <antonio.poggiali at datalogic dot com> --- I've understand a little better the problem. The compiler passes to std::list copy constructor a different address respect to the destination variable. This causes size() call to fail (endless loop or segmentation fault). Here you can find a simpler test-bench: #include <iostream> using namespace std; class TestReference { public: // This is a pointer to me const TestReference * _me; TestReference() { _me = this; } TestReference(const TestReference &obj) { _me = this; } }; class SmartObject { public: SmartObject(){} // removing this destructor makes it work virtual ~SmartObject(){} }; class IMyInterface { public: IMyInterface(){} // removing this destructor have no effect (fails anyway) virtual ~IMyInterface(){} virtual TestReference getTestReference() = 0; }; // inheriting SmartObject virtually makes it work (but it is not feasible on the overall application architecture) class MyObject : public virtual IMyInterface, public SmartObject { public: MyObject() : IMyInterface(), SmartObject() {} virtual TestReference getTestReference() { return testReference; } virtual ~MyObject(){ } TestReference testReference; }; int main() { IMyInterface *ip = new MyObject(); TestReference TestReference_local; std::cout << "object address " << &TestReference_local << std::endl; std::cout << "object address in constructor " << TestReference_local._me << std::endl; if (&TestReference_local != TestReference_local._me) std::cout << "warning! addresses are different!" << std::endl; TestReference TestReference_clone = ip->getTestReference(); std::cout << "object address " << &TestReference_clone << std::endl; std::cout << "object address in copy constructor " << TestReference_clone._me << std::endl; if (&TestReference_clone != TestReference_clone._me) std::cout << "warning! addresses are different!" << std::endl; delete ip; return 0; } Basically I expect the object address in the copy constructor (this) to be the same of the object in the calling code, but when the program fails it is not so! on arm-linux: object address 0xbeaf9be8 object address in constructor 0xbeaf9be8 object address 0xbeaf9bec object address in copy constructor 0xbeaf9be4 warning! addresses are different! on x64-linux: object address 0x7ffff2be7410 object address in constructor 0x7ffff2be7410 object address 0x7ffff2be7420 object address in copy constructor 0x7ffff2be7420