This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
direct_notype_declarator and constructors
- To: gcc-patches at gcc dot gnu dot org
- Subject: direct_notype_declarator and constructors
- From: Clinton Popetz <cpopetz at cygnus dot com>
- Date: Fri, 25 Feb 2000 15:23:56 -0600
Removing the precedence declaration from this rule in cp/parse.y:
direct_notype_declarator:
complex_direct_notype_declarator
/* This precedence declaration is to prefer this reduce
to the Koenig lookup shift in primary, below. I hate yacc. */
| notype_unqualified_id %prec '('
Causes g++.brendan/parse4.C to XPASS, and introduces no new failures in
check-g++.
The test looks like:
class B
{
public:
B( int t ) {}
void f() {}
};
int g() { return 0; } // gets bogus error - referenced below XFAIL *-*-*
int main()
{
B( g() ).f(); // gets bogus error - treated as decl XFAIL *-*-*
}
Can someone post code that exhibits the need for the %prec? If not, is the
patch below ok? FWIW, this introduces two shift/reduce conflicts ('(' and
LEFT_RIGHT) which bison resolves as reduce.
(Disclaimer: backend mole attempts to pull weeds above ground in the C++
parser, is nearly trampled by a bison, and dives back underground.)
-Clint
2000-02-25 Clinton Popetz <cpopetz@cygnus.com>
* parse.y (direct_notype_declarator): Don't use precedence
declaration.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/parse.y,v
retrieving revision 1.167
diff -c -2 -p -r1.167 parse.y
*** parse.y 2000/02/25 01:36:03 1.167
--- parse.y 2000/02/25 21:20:32
*************** notype_template_declarator:
*** 1428,1434 ****
direct_notype_declarator:
complex_direct_notype_declarator
! /* This precedence declaration is to prefer this reduce
! to the Koenig lookup shift in primary, below. I hate yacc. */
! | notype_unqualified_id %prec '('
| notype_template_declarator
| '(' expr_or_declarator_intern ')'
--- 1428,1432 ----
direct_notype_declarator:
complex_direct_notype_declarator
! | notype_unqualified_id
| notype_template_declarator
| '(' expr_or_declarator_intern ')'