https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113219

--- Comment #2 from m.cencora at gmail dot com ---
So I guess this falls into the "confusing overload resolution for user-defined
conversion" but I fail to see what can be confusing here.
createInt() returns prvalue, so later it binds to xvalue for the purpose of
implicit conversion operator invocation. That means that r-value qualified
conversion operator is chosen.

If your advice is to avoid using "-Wconversion" that it is rather unfortunate
because user looses good warnings (e.g. about conversions that may alter the
value).
Also there is no way to silence the warning for such a code, since gcc warns on
each call-site, not on definition-site of the overloads.
So it either unfeasible or even impossible if the definitions are in library
code, but warnings are enabled in user code.

Please consider removing the warning generation in such scenarios.

Reply via email to