[net.lang.c++] Cornell Bug Report #1 of 3

gdykes@batcomputer.TN.CORNELL.EDU (Gene Dykes) (06/19/86)

The "duplicate destructor" problem...

- - - - - - -

class
c_dbg	{
	c_dbg() ;
	~c_dbg() ;
	} ;

main()
{
void f() ;
f() ;
}

void
f()
{
c_dbg	dummy ;
return ;
}

- - - - - -

The above construct when compiled by CC results in the warning...

	"line 16: warning: statement not reached"

I have a class that uses this construct in lots of functions, so I have
to suffer through this warning endless times.  It's by no means a fatal
bug, but certainly annoying.

(A look at the code produced shows that the destructor is declared, invoked,
then the function returns, and then the destructor is called again, and
it is this second call which can't be reached since it is just after
the return statement.)
-- 
Gene Dykes, 120 Rand Hall, Cornell U., Ithaca, NY 14853 (607)255-6713
{ihnp4,decvax,allegra,vax135}!cornell!batcomputer!gdykes