🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #920

g++ and groff's c++test.c

#920
From: gregg hanna
Date: Tue, 11 Aug 1992 07:03
48 lines
1354 bytes
Hi,

  I was trying to build groff but it didn't pass the c++
compiler test in c++test.c, which is:

#include <stdio.h>

struct A {
  A() { fputs("A\n", stdout); }
  ~A() { fputs("~A\n", stdout); }
};

A a;

main()
{
  return 0;
}


I thought maybe the optimizer trashed it, but I tried it
several different ways.  It appears that g++ does not call
the creator for statically declared variables.  Is this
correct behavior?  The following, however, works fine:

#include <stdio.h>

struct A {
  A() { fputs("A\n", stdout); }
  ~A() { fputs("~A\n", stdout); }
};

main()
{
  A a;
  return 0;
}


If this is not a bug, perhaps the groff people should
be notified, since groff-1.05 currently will not compile
if it fails the c++test.  By the way, the groff people
expect the output of the program to be:
A
~A

                                            gregg hanna
                                            gregor@kafka.saic.com
Technical Details
Message-ID: <9208110703.AA19545@kafka.saic.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!kafka.saic.com!gregor

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!kafka.saic.com!gregor
From: gregor@kafka.saic.com (gregg hanna)
Subject: g++ and groff's c++test.c
Message-ID: <9208110703.AA19545@kafka.saic.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 11 Aug 1992 07:03:17 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 49