🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by klotz Mon, 21 Aug 1989 00:00
bug in g++ 1.35.1- with ({}) construct and automatic destructors
#362
Author: klotz
Date: Mon, 21 Aug 1989 00:00
45 lines
1811 bytes
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 <stdio.h>

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
% 

----------------------------------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads