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

            Bug ID: 91407
           Summary: Wnon-virtual-dtor should't fire for classes with
                    operator delete=delete
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asorenji at gmail dot com
  Target Milestone: ---

Okay, attempt of delete polymorphic class without virtual destructor, lead to
UB. But, I want trivially destructible class with virtual functions. So, I just
mark operator delete as delete. No delete expression - no problem. But gcc
still show me a warning.

gcc (Debian 8.3.0-6) 8.3.0
Command line:
gcc main.cpp -Wnon-virtual-dtor
Source:

class Test
{
public:
    virtual void foo(){}
    void operator delete(void*)=delete;
};
int main()
{
    return 0;
}

Yes, yes, although "delete pointer" don't work, "::delete pointer" still
worked. But it's just a shoot in the foot.

Reply via email to