🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by "Douglas C. Schmidt" Tue, 03 Jan 1989 01:36
g++ 1.32 can't parse recent C++ syntax
#1593
Author: "Douglas C. Schmidt"
Date: Tue, 03 Jan 1989 01:36
34 lines
1366 bytes
Hi,

   The following cryptic looking C++ code comes from page 309 of
Stroustrup and Lippman's ``Pointers to Class Members in C++'' article
from the USENIX C++ Conference, 1988.  It fails to compile on g++ 1.32.

Here's the code:
----------------------------------------
class X {
public:
   int i;
   void foo ( int ) {
   }
};

main ( int, char *argv [ ] ) {
   void (X::*pmfXVi2)(int) = &X::foo;
}
----------------------------------------

Here are the diagnostics:

----------------------------------------
In function main (int, char **):
bug.c:10: parse error before `*'
----------------------------------------

Note that if the declaration is moved to the outer scope ( i.e.,
outside of main() ) the compiler handles this correctly ( there seems
to be a general problem correctly parsing with this type of
declaration in both g++ and cfront 1.2.1. ).

Doug
g++ 1.32 can't parse recent C++ syntax
#1618
Author: Michael Tiemann
Date: Mon, 16 Jan 1989 18:57
25 lines
904 bytes
   class X {
   public:
      int i;
      void foo ( int ) {
      }
   };

   main ( int, char *argv [ ] ) {
      void (X::*pmfXVi2)(int) = &X::foo;
   }

GNU C++ cannot handle

	void (*pf)(int);

and it cannot handle

	void (X::*pmf)(int);

for the same reason.  It can handle

	auto void (X::*pmf)(int);

Michael
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