Missing deprecated-copy-dtor warning in Clang-10

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Missing deprecated-copy-dtor warning in Clang-10

Keane, Erich via cfe-dev
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@

--
Milan Kříž | Software engineer | Eccam s.r.o. | +420 724 778384 | [hidden email]
Krakovská 9 | Praha 11000 | Czech Republic



_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

smime.p7s (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Missing deprecated-copy-dtor warning in Clang-10

Keane, Erich via cfe-dev
On 23 Jul 2020, at 09:30, Milan Kříž via cfe-dev <[hidden email]> 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ý <[hidden email]>
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


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

signature.asc (230 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Missing deprecated-copy-dtor warning in Clang-10

Keane, Erich via cfe-dev
Right. 


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




Odoslané z iPhonu

Dňa 23. 7. 2020 o 20:18 užívateľ Dimitry Andric <[hidden email]> napísal:

On 23 Jul 2020, at 09:30, Milan Kříž via cfe-dev <[hidden email]> 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ý <[hidden email]>
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


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev