This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
ambiguity resolution problem in parsing
- To: egcs-bugs at cygnus dot com
- Subject: ambiguity resolution problem in parsing
- From: scott snyder <snyder at d0sgif dot fnal dot gov>
- Date: Mon, 06 Jul 1998 15:04:46 CDT
hi -
This was observed with egcs egcs-2.91.45 19980702 on a mips-sgi-irix6.2
platform.
Egcs seems to have a problem in disambiguating between a function
declaration and an object delcaration if more than one parameter
is involved. For example, for this source:
------------------------------------------------------------------------
class AbsSelector {};
class TKey {
public:
TKey(const AbsSelector& aSel, int);
};
int main()
{
TKey tkeyS5 (AbsSelector(), 0);
}
------------------------------------------------------------------------
egcs gives the diagnostics
bug40.cc: In function `int main()':
bug40.cc:10: type specifier omitted for parameter
bug40.cc:10: parse error before `0'
it appears that, in this instance, egcs is attempting to interpret
the declaration of the object `tkeyS5' as a function declaration.
>From [dcl.ambig.res], it appears that a construct like this
is supposed to be interpreted as a function declaration if that
is syntactically allowed; otherwise, it is interpreted as an
object definition. In this case, the declaration cannot be interpreted
as a function declaration, but can be interpreted as an object declaration.
This can only be determined, however, by looking at the second parameter.
sss