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

Steinar H. Gunderson <steinar+gcc at gunderson dot no> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steinar+gcc at gunderson dot no

--- Comment #17 from Steinar H. Gunderson <steinar+gcc at gunderson dot no> ---
Hi,

Does this change mean now it's effectively impossible to have abstract base
classes under -Wall without adding boilerplate? Consider something like the
following:

class Base {
public:
  virtual ~Base() {}
  virtual void foo() = 0;
};

class Derived : Base {
public:
  ~Derived();
  void foo() override;
};

Base needs to have a virtual destructor since it has virtual member functions
(or half the world will give you warnings).

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!

Am I missing something?

Reply via email to