https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68300
Bug ID: 68300 Summary: Bogus -Wnon-virtual-dtor warning with protected base class constructor Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: trippels at gcc dot gnu.org Target Milestone: --- markus@x4 ~ % cat non_virt.ii class A { protected: ~A(); public: friend struct C; virtual void foo(); }; class B final : public A { void foo() override; }; markus@x4 ~ % clang++ -Wnon-virtual-dtor -c -std=c++14 non_virt.ii markus@x4 ~ % g++ -Wnon-virtual-dtor -c -std=c++14 non_virt.ii non_virt.ii:1:7: warning: ‘class A’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor] class A { ^ non_virt.ii:10:7: warning: base class ‘class A’ has accessible non-virtual destructor [-Wnon-virtual-dtor] class B final : public A { ^ The warning goes away if I comment out the friend declaration.