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

--- Comment #18 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Steinar H. Gunderson from comment #17)
> Base needs to have a virtual destructor since it has virtual member
> functions (or half the world will give you warnings).

Or a protected destructor, but that doesn't change anything relevant to your
problem.

> Any attempts now to copy Derived through the implicit copy constructor will
> give a warning, since the synthesis of Base::Base(const Base &) is
> deprecated. The only way I've found to suppress this is to add
> 
>   Base::Base(const Base &) = default;
> 
> However, this in turn disables the synthesis of Base::Base(), and also
> Base::operator=(const Base &). So I need:
> 
>   Base() = default;
>   Base(const Base &) = default;
>   Base(Base &&) = default;
>   Base &operator= (const Base &) = default;
>   Base &operator= (Base &&) = default;
> 
> for something that doesn't have a single member!

Yes. The deprecation means a future version of C++ might make your type
non-copyable. To explicitly say it's copyable (and make the code futureproof)
you need to add those defaulted members.

If you don't want to do that, you can use -Wno-deprecated-copy to suppress the
warnings.

Reply via email to