🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #382

Bug in reference handling? (1.35.1-)

#382
From: chatty%FRLRI61.BITNET
Date: Wed, 30 Aug 1989 12:21
35 lines
954 bytes
In the following code, the function foo is called each time the reference x is u

I use g++ 1.35.1- on a Sun3 OS3.5.

class A {
public :
        void bar () {}
};

A&
foo ()
{
        printf ("foo\n");
        return *(new A);
}

main ()
{
        A& x = foo ();
        x.bar ();
        x.bar ();
}

% g++ a.cc
In function struct A &foo ():
a.cc:9: warning: implicit declaration of function `printf'

% a.out
foo
foo
foo


Stephane Chatty         chatty@frlri61.bitnet
                        chatty@lri.lri.fr
Technical Details
Message-ID: <8908301221.AA05398@lri.lri.fr>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!CUNYVM.CUNY.EDU!chatty%FRLRI61.BITNET

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!CUNYVM.CUNY.EDU!chatty%FRLRI61.BITNET
From: chatty%FRLRI61.BITNET@CUNYVM.CUNY.EDU
Newsgroups: gnu.g++.bug
Subject: Bug in reference handling? (1.35.1-)
Message-ID: <8908301221.AA05398@lri.lri.fr>
Date: 30 Aug 89 12:21:23 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 35