-
Notifications
You must be signed in to change notification settings - Fork 786
Description
[dcl.init.ref] paragraph 5, bullet 4, sub-bullet 1 specifies the following:
If T1 or T2 is a class type and T1 is not reference-related to T2, user-defined conversions are
considered using the rules for copy-initialization of an object of type “cv1 T1” by user-defined
conversion (9.4, 12.4.1.4, 12.4.1.5); the program is ill-formed if the corresponding non-reference
copy-initialization would be ill-formed. The result of the call to the conversion function, as
described for the non-reference copy-initialization, is then used to direct-initialize the reference.
For this direct-initialization, user-defined conversions are not considered.
The highlighted wording (which requires performing direct initialization after applying the user-defined conversion) was added in CWG1604. Given that "user-defined conversions are not considered" for the next step of the initialization, I believe that requiring a specific type of initialization does not have any effect on the outcome.
I think there is another issue with the quoted text above, namely:
[...] The result of the call to the conversion function [...]
I believe that the user-defined conversion referred to here could use either a converting constructor or a conversion function, not just a conversion function.
Thank you!