Compilation problem with gcc-3.0

Mark Mitchell mark at codesourcery.com
Wed Jun 27 19:44:34 UTC 2001



--On Wednesday, June 27, 2001 01:55:14 PM -0600 Dave Nystrom <wdn at lanl.gov> 
wrote:

> Below is a small test case that includes two functions, find1 and find2.
> When I try to compile this with the g++ from gcc-3.0, I get the following
> error:

Yes, this is a famous problem in GCC -- it uses a YACC parser that
doesn't have enough look-ahead to see whether or not that construct
is a function-declaration or an expression.  We need a new parser.

I've begged LANL to let me do that for years -- and they agreed!  In
fact, what I'm working on right now, is writing a nice bright shiny new
C++ parser -- and it aready gets this example correct.  So, I'd expect
this to be fixed in G++ 3.1, probably ready in about 6 months.  And,
in development snaphots before that.

Besides the workaround you found, another one that usually works is:

  C* pclass ((0, unwrap<C*>()(*object)));

The `0' can't appear in a parameter-declaration, so g++ knows pclass
is a variable, and not a function.

-- 
Mark Mitchell                mark at codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com



More information about the pooma-dev mailing list