Path: utzoo!attcan!uunet!mcsun!hp4nl!sci.kun.nl!atcmpe!leo From: leo@atcmp.nl (Leo Willems) Newsgroups: comp.lang.c++ Subject: explicit virtual destructor call Keywords: destructor virtual Message-ID: <667@atcmpe.atcmp.nl> Date: 4 Oct 90 11:21:37 GMT Organization: AT Computing, Nijmegen, The Netherlands Lines: 30 In par. 12.4 (last part) of E&S the difference between a virtual/static destructor call is clearified. The virtual call syntax is not accepted by all C++ compilers I have access to, the most current version is Comeau's 2.1 port for the 3b2/600. class X { public: X(){ cout << "X::X()\n"; } virtual ~X(){ cout << "X::~X()\n"; } }; void h(X& a) { a.~X(); // virtual..... but generates syntax error. a.X::~X(); // static...... compiles, and behaves virtual!! } Should this program compile? If so are there already compilers that do? Thanks Leo BTW, what is the meaning of the 'extern gg(X&)' in the E&S example, it's not a simple typo (s/gg/h/) because the returntypes are different?