The example in [class.conv.ctor]/2 contains the following initialization:
Z a3 = Z(1);    // OK: direct initialization syntax used
How is this considered a direct-initialization syntax?
Z(1) will direct-initialize a prvalue. The prvalue will then be used to initialize an object. By the rules of guaranteed elision, there is no temporary-followed-by-copy. The prvalue initializes the object directly. Therefore, Z a3 = Z(1); is exactly equivalent to Z a3(1);.
In pre-C++17, this would perform direct initialization of a prvalue temporary, followed by a (almost certainly elided) copy of the temporary into the object a3. Whether the copy is elided or not, the initialization of the prvalue is via direct initialization. The initialization of a3 is by copy-initialization, but this is through the copy constructor, which is not explicit.
It's talking about Z(1). [dcl.init]/16:
The initialization that occurs in [...] functional notation type conversions (5.2.3) [...] is called direct-initialization.
The prvalue is then used to copy-initialize z, which is just fine, guaranteed elision or not - Z's copy/move constructors aren't explicit anyway, so the initialization is fine even without the guaranteed elision in C++17.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With