ElisionTest(ElisionTest& other);
A constructor with that signature allows the initialization of an ElisionTest
instance through an lvalue. When you do this:
ElisionTest et = 10;
This will construct an instance of ElisionTest
from a temporary. Your code is equivalent to:
ElisionTest et = ElisionTest(10);
This will call your constructor that takes a non-const reference and initialize et
with that. But a non-const reference cannot be bound to a temporary. That's why we will need to add const
to your copy-constructor so that it can support both lvalues and rvalues:
ElisionTest(ElisionTest const& other);
// ^^^^^
The reason you are seeing no output is because of something called copy-elision. The compiler can omit the call to the copy/move constructor. In GCC, you can use -fno-elide-constructors
to turn off copy-elision.