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

            Bug ID: 62221
           Summary: Explicit base destructor call acccepted
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: potswa at mac dot com

#include <new>

struct b {
        virtual ~ b() {}
};

struct d : b {
        ~ d () {}
};

int main() {
        d o;
        o.~b();
        new( & o ) d;
}


This is ill formed but is accepted. Clang, EDG, and MSVC all reject it.

[basic.lookup.classref]p3:

"If the type T of the object expression is of a class type C, the type-name is
also looked up in the scope of class C. At least one of the lookups shall find
a name that refers to (possibly cv-qualified) T."

Reply via email to