Xref: utzoo comp.lang.c++:3565 gnu.g++:210 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!shelby!agate!eos!ames!sgi!kipp@warp.wpd.sgi.com From: kipp@warp.wpd.sgi.com (Kipp Hickman) Newsgroups: comp.lang.c++,gnu.g++ Subject: C++ compiler enhancement request Keywords: pitfalls Message-ID: <34709@sgi.SGI.COM> Date: 7 Jun 89 04:36:52 GMT Sender: daemon@sgi.SGI.COM Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 27 Say you have the following class: class Something ... { virtual ~Something(); }; If you do this: Something* s = ...; delete s; then s is deleted with its virtual function, right? Well, not always. If you don't include the declaration for Something, but instead say this: class Something; you get into trouble because the compiler doesn't know to invoke the virtual destructor (or any destructor for that matter). A nice compiler tweak would be to generate warning messages when system operators are applied to forward declared objects. does 2.0 do this? does g++ do this? cfront 1.2.1 doesn't... comments (email please)? kipp hickman silicon graphics inc.