Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ARISIA.XEROX.COM!klotz From: klotz@ARISIA.XEROX.COM Newsgroups: gnu.g++.bug Subject: bug in g++ 1.35.1- with ({}) construct and automatic destructors Message-ID: <8908210000.AA00725@fast.parc.xerox.com> Date: 21 Aug 89 00:00:41 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 45 We're using G++ 1.35.1- on a Sun 330, with SunOS release 4.0.3. The following changes have been made in configuration: tm.h -> tm-sparc+.h; md -> sparc.md The value returned from the ({}) construct for blocks which have objects with destructors is the value of the destructor (i.e., void which yields an error). The bug does not happen if the objects are created with the default no-argument constructor. Compile the following file: ---------------------------------------------------------------- #include struct fred { int x; fred(int x_val) { x = x_val; } ~fred() { printf("fred destroyed\n"); } }; main() { int val; val = ({ fred fred_1(100); 7; }); printf("Val = %d\n", val); } ---------------------------------------------------------------- % g++ -v destruct.c -o destruct g++ version 1.36.0- /import/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__GNUC__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ destruct.c /tmp/cca00719.cpp GNU CPP version 1.35.96 /import/g++-1.35.1-/cc1plus /tmp/cca00719.cpp -quiet -dumpbase destruct.c -noreg -version -o /tmp/cca00719.s GNU C++ version 1.35.1- (sparc) compiled by GNU C version 1.35. In function int main (): destruct.c:16: void value not ignored as it ought to be % ----------------------------------------------------------------