[cfe-dev] Missing deprecated-copy-dtor warning in Clang-10

Dimitry Andric via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 23 11:18:43 PDT 2020


On 23 Jul 2020, at 09:30, Milan Kříž via cfe-dev <cfe-dev at lists.llvm.org> wrote:
...
> Clang versions 5, 6, 7, 8, 9 (and probably earlier) fire the following warning (when using -Wdeprecated):
> <source>:6:13: warning: definition of implicit copy constructor for 'ITest' is deprecated because it has a user-declared destructor [-Wdeprecated]
>     virtual ~ITest() = default;
>             ^
> <source>:10:7: note: in implicit copy constructor for 'ITest' first required here
> class TestImpl : public ITest
>       ^
> <source>:19:22: note: in implicit move constructor for 'TestImpl' first required here
>     TestImpl impl2 = std::move(impl1);
> 
> I understand that in standard the definition of implicit copy constructor is really deprecated and even though I don't like it, I believe that the warning is correct. However starting with clang-10.0.0, the warning disappears. I noticed that there is a new sub-option -Wdeprecated-copy-dtor, but it also doesn't help to get the warning. I even tried to add some members to ITest, but the warning doesn't appear anyway. Is it a bug or desired behavior?

See https://github.com/llvm/llvm-project/commit/9e260c12bce77c80aa4da64ac44874687c684580:

commit 9e260c12bce77c80aa4da64ac44874687c684580
Author: Dávid Bolvanský <david.bolvansky at gmail.com>
Date:   Sat Nov 23 23:57:17 2019 +0100

    [Diagnostics] Make behaviour of Clang's -Wdeprecated-copy same as in GCC

    Do not warn for  functions that are explicitly marked delete or default, which follows the behavior of the GCC warning.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 223 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200723/78e66c99/attachment.sig>


More information about the cfe-dev mailing list