🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by "Robert S. French" Fri, 21 Apr 1989 01:50
G++ 1.34.1: Bug with function prototypes
#1887
Author: "Robert S. French"
Date: Fri, 21 Apr 1989 01:50
21 lines
980 bytes
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.

			Rob
G++ 1.34.1: Bug with function prototypes
#1881
Author: Michael Tiemann
Date: Fri, 21 Apr 1989 02:57
23 lines
1039 bytes
   Date: Thu, 20 Apr 89 21:50:28 EDT
   From: "Robert S. French" <rfrench@athena.mit.edu>
   Sender: rfrench@athena.mit.edu


   The file:

	   void foo(int (*pfri)());

   causes g++ 1.34.1 to error out with:

   [ ... ]

Yes.  This is a documented lossage of GNU C++.  If you want to know
why it loses, look in g++.texinfo, and search for the string

inherently ambiguous

This phrase describes the C++ grammar, and the containing paragraph
explains why I decided to not waste time trying to deal with it.

Michael
Re: G++ 1.34.1: Bug with function prototypes
#1882
Author: Doug Schmidt
Date: Fri, 21 Apr 1989 05:09
55 lines
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 |
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