Missing deprecated-copy-dtor warning in Clang-10

Hi,

I've a question about a clang warning which is fired under -Wdeprecated in older versions of clang (definition of implicit copy constructor for 'ITest' is deprecated).

include <utility>

class ITest
{
public:
virtual ~ITest() = default;
virtual void testMethod() = 0;
};

class TestImpl : public ITest
{
public:
virtual void testMethod() override {};
};

int main()
{
TestImpl impl1;
TestImpl impl2 = std::move(impl1);
return 0;
}

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?

Thanks,
Mi-L@

...

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@gmail.com>

    [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

Right.

See https://reviews.llvm.org/D79714

I just need some time to rebase and update it. :frowning: this weekend, hopefully.

Odoslané z iPhonu