This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: possible parser bug?


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
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]