https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86225
Bug ID: 86225 Summary: Missing error message Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zhonghao at pku dot org.cn Target Milestone: --- The code is as follow: struct A { virtual ~A () {} }; struct B : public A { virtual ~B () {} }; template < int > void foo () { B *b = new B; b->~A (); } int main () { foo < 0 > (); return 0; } g++ accepts the code, but clang++ rejects it. The error message is as follow: error: destructor type 'A' in object destruction expression does not match the type 'B' of the object being destroyed b->~A (); note: type 'A' is declared here struct A ^ 1 error generated. Shall g++ present similar error messages?