Article View: gnu.g++.bug
Article #1882Re: G++ 1.34.1: Bug with function prototypes
From: Doug Schmidt
Date: Fri, 21 Apr 1989 05:09
Date: Fri, 21 Apr 1989 05:09
55 lines
2187 bytes
2187 bytes
In article <8904210150.AA00613@OLIVER.MIT.EDU> rfrench@ATHENA.MIT.EDU ("Robert S. French") writes:
++
++ The file:
++
++ void foo(int (*pfri)());
++
++ causes g++ 1.34.1 to error out with:
++
++ g++ version 1.34.1
++ /mit/gnu/vaxlib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dvax -Dunix -D__vax_
++ _ -D__unix__ /tmp/foo.c /tmp/cc000608.cpp
++ GNU CPP version 1.34
++ /mit/gnu/vaxlib/gcc-c++ /tmp/cc000608.cpp -quiet -dumpbase /tmp/foo.c -version
++ -o /tmp/cc000608.s
++ GNU C++ version 1.34.1 (vax) compiled by GNU C version 1.34.
++ /tmp/foo.c:1: `pfri' undeclared, outside of functions
++ /tmp/foo.c:1: bad parameter list specification for function `foo'
++
++
++ The same file goes through gcc 1.34 fine.
This is a known problem with g++ (see g++.texinfo). Don't expect a
fix anytime soon. The work around is as follows for your particular
case:
void foo(auto int (*pfri)());
^^^^
note this...
Yes this is annoying, yes it would be nice if it worked `as expected',
no I don't have a good fix for this, and if you figure one out please
let us know! ;-)
Doug
p.s. Note that a similar problem occurs within functions, i.e.,
foo ()
{
int (*i)();
}
also fails with g++. The fix is the same here too:
foo ()
{
auto int (*i)();
}
(or use a typedef).
--
On a clear day, under blue skies, there is no need to seek.
And asking about Buddha +------------------------+
Is like proclaiming innocence, | schmidt@ics.uci.edu |
With loot in your pocket. | office: (714) 856-4043 |
Technical Details
Message-ID:
<12404@paris.ics.uci.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!bionet!ames!elroy!ucla-cs!uci-ics!zola.ics.uci.edu!schmidtReferences:
<8904210150.AA00613@OLIVER.MIT.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!bionet!ames!elroy!ucla-cs!uci-ics!zola.ics.uci.edu!schmidt From: schmidt@zola.ics.uci.edu (Doug Schmidt) Newsgroups: gnu.g++.bug Subject: Re: G++ 1.34.1: Bug with function prototypes Message-ID: <12404@paris.ics.uci.edu> Date: 21 Apr 89 05:09:26 GMT References: <8904210150.AA00613@OLIVER.MIT.EDU> Sender: news@paris.ics.uci.edu Reply-To: Doug Schmidt <schmidt@zola.ics.uci.edu> Distribution: gnu Organization: University of California at Irvine: ICS Dept. Lines: 55