This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: possible parser bug?
- To: "'Michael Iber'" <michael dot iber at siemens dot at>, egcs at cygnus dot com
- Subject: RE: possible parser bug?
- From: "Wegher, Jeff" <JWegher at neonsoft dot com>
- Date: Fri, 6 Nov 1998 11:48:12 -0700
Your line:
B(GetA()->f());
looks like a function declaration rather than a constructor, and it's
invalid syntax for a function declaration.
Try B aB(GetA()->f());
Works fine.
Jeff
> -----Original Message-----
> From: Michael Iber [SMTP:michael.iber@siemens.at]
> Sent: Friday, November 06, 1998 5:25 AM
> To: egcs@cygnus.com
> Subject: possible parser bug?
>
> I have a problem with the egcs parser.
> It raises an error message on code that seems syntactically correct to me.
> It seems the egcs parser knows, it is inside a constructor parameter list.
>
> In a function call parameter list there is no parse error.
>
> the code:
>
> class A
> {
> public:
> A() {};
> int f() { return 1; };
> };
>
> class B
> {
> public:
> B(int) {};
> };
>
> A* GetA() { return new A(); };
>
> int main()
> {
> B(GetA()->f());
> }
>
> the error message:
>
> test1.cxx: In function `int main()':
> test1.cxx:18: parse error before `->'
>
> egcs-1.0.3, egcs-1.1 and egcs-ss981101 show the same behaviour.
>
> mike
>