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

--- Comment #3 from Manuel López-Ibáñez <lopezibanez at gmail dot com> ---
> --- Comment #2 from Matt Godbolt <matt at godbolt dot org> ---
> Thanks Manuel. Interestingly this does elicit a warning:
>
> struct B {
>   int a; int b;
>   B(B &&o)
>     : a(static_cast<int>(a)),
>       b(std::move(o.b)) {}
> };

Most probable, the FE removes the cast before reaching this warning, so the
warning does not see an expression.  If you cast to something non trivial,
it remains an expression and the warning doesn't try to look inside it.

I wonder what happens if you do a(b), a(a). Does it still warn? My guess
would be yes. If so, it is just checking for equality on both sides, no
attempt to look within expressions nor track initialisation.

Reply via email to