public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: bug w/ your May 8 change
       [not found] <9597.894929289@lisa.cygnus.com>
@ 1998-05-12 10:17 ` Martin v. Loewis
  0 siblings, 0 replies; only message in thread
From: Martin v. Loewis @ 1998-05-12 10:17 UTC (permalink / raw)
  To: egcs; +Cc: brendan

> 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  <loewis@informatik.hu-berlin.de>

	* 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;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-05-12 10:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <9597.894929289@lisa.cygnus.com>
1998-05-12 10:17 ` bug w/ your May 8 change Martin v. Loewis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).