Notice 0x22ff00. No constructor that I provided was called for this object. How is this even possible?
Further note: Line 32/59 is the move constructor/operator. If I include them GCC fails to compile with the following error:
D:\temp\temp\test2\main.cpp|130|error: use of deleted function 'constexpr test::shared_ptr<A>::shared_ptr(const test::shared_ptr<A>&)'|
The output is not the problem. It reflects exactly what happend. The problem is that the assertion failed. The reason for this is that I have 2 increments and 3 [tries] decrements.
I don't know how the call of the constructor is circumvented or what I am doing wrong so that it happens.
D:\temp\temp\test2\main.cpp|130|error: use of deleted function 'constexpr test::shared_ptr<A>::shared_ptr(const test::shared_ptr<A>&)'
Honestly I don't know what that means.
When I include the move constructor/operator Visual C++ compiles, but the assertion remains. It looks like as if my move constructor/operator is ignored somehow.
A non-template constructor for class X is a copy constructor if its first parameter is of type X&, const X&, volatile X& or const volatile X&, and either there are no other parameters or else all other parameters have default arguments
...
A non-template constructor for class X is a move constructor if its first parameter is of type X&&, const X&&, volatile X&&, or const volatile X&&, and either there are no other parameters or else all other parameters have default arguments
- IS
> A move constructor is implicitly generated while a copy constructor is not?
If any move, copy, or destructor is explicitly specified (declared, defined, =default, or =delete) by the user, no move is generated by default. If any move, copy, or destructor is explicitly specified (declared, defined, =default, or =delete) by the user, any undeclared copy operations are generated by default, but this is deprecated, so don't rely on that. http://www.stroustrup.com/C++11FAQ.html#default
So, I'd say no move if not explicitly told. I don't want it since I want to keep the inteface as sparse as possible and for a pointer move seems not to make overly sense.