Hello, I'm using Intel's 12.1 compiler with Visual Studio 2010 IDE, making 64 bit target. See code in 2 attached files.
The problem is that this code compiles and it should trigger an error. As expected, it fails with the Microsoft compiler with error C2248 cannot access protected member... .
The Worker class constructor is not public and so it should not be accessible from std::make_shared<Worker>(...). Is this a compiler defect?
I have tried things such as making the Worker constructor private with the same outcome.
I tried completely removing the Worker constructor with 2 arguments, and the code still compiles with no complaint.
I tried making the call to std::make_shared in the constructor body rather than in member initialization. No improvement.
It seems like the compiler is not checking for access to construct the object managed by the std::shared_ptr<...>.
Thanks for looking