From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Martin v. Loewis" To: egcs@cygnus.com Cc: brendan@cygnus.com Subject: Re: bug w/ your May 8 change Date: Tue, 12 May 1998 10:17:00 -0000 Message-id: <199805121716.TAA08313@punica> References: <9597.894929289@lisa.cygnus.com> X-SW-Source: 1998-05/msg00408.html > Hi! Your change to IDENTIFIER_TYPE_VALUE introduced an interesting > bug. If you try to compile the file below (after uudecoding it), > you'll see it go into an infinite loop between lookup_name_real and > identifier_type_value. Brendan, Thanks for your test case. A fix and two regression tests are included below. Index: decl.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v retrieving revision 1.103 diff -c -p -r1.103 decl.c *** decl.c 1998/05/09 18:10:26 1.103 --- decl.c 1998/05/12 17:09:36 *************** lookup_name_real (name, prefer_type, non *** 4812,4818 **** locval = classval = NULL_TREE; if (!current_binding_level->namespace_p ! && IDENTIFIER_LOCAL_VALUE (name)) locval = IDENTIFIER_LOCAL_VALUE (name); /* In C++ class fields are between local and global scope, --- 4812,4820 ---- locval = classval = NULL_TREE; if (!current_binding_level->namespace_p ! && IDENTIFIER_LOCAL_VALUE (name) ! && (prefer_type <= 0 ! || TREE_CODE (IDENTIFIER_LOCAL_VALUE (name)) == TYPE_DECL)) locval = IDENTIFIER_LOCAL_VALUE (name); /* In C++ class fields are between local and global scope, Tue May 12 19:11:13 1998 Martin v. Loewis * decl.c (lookup_name_real): When requesting a type, don't return a local non-type. --------------------------------------------------------------------- //Build don't link: //A local non-type name is ignored when searching an elaborated type name struct S{}; void f() { struct S S; struct S s1; } --------------------------------------------------------------------- //Build don't link: //A local typedef works as a type struct S{}; void f() { typedef struct S R; R s1; }