[Bug c++/85043] -Wuseless-cast false positive for temporary objects

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 23 14:54:00 GMT 2018


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot com

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thanks guys. Jakub, I agree that focusing too much on constructors is a red
herring, but it's also true that as soon as a non trivial copy constructor is
involved *anything* can happen while handling the *same* source and destination
types. IMHO, the testcase in the bug report is very cute, even too much,
because it doesn't take much to construct a useful cast to the same type! In
hindsight the name of the warning is really wrong. Anyway, that said, in
practice, if we agree that the warning would still be useful restricted to
non-class types, the fix would too easy to implement!! Probably together with a
clarification in the docs.


More information about the Gcc-bugs mailing list