Am Montag, 16. März 2026, 19:40:09 Mitteleuropäische Normalzeit schrieb Jason 
Merrill:
> On 3/15/26 7:57 AM, Thomas Berger wrote:
> > diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc
> > index 13aafab4e68..8addd3b29ca 100644
> > --- a/gcc/cp/name-lookup.cc
> > +++ b/gcc/cp/name-lookup.cc
> > @@ -1848,6 +1848,7 @@ member_vec_linear_search (vec<tree, va_gc>
> > *member_vec, tree name)> 
> >   static tree
> >   fields_linear_search (tree klass, tree name, bool want_type)
> >   {
> > 
> > +  tree found = NULL_TREE;
> > 
> >     for (tree fields = TYPE_FIELDS (klass); fields; fields = DECL_CHAIN
> >     (fields))>     
> >       {
> >       
> >         tree decl = fields;
> > 
> > @@ -1878,11 +1879,23 @@ fields_linear_search (tree klass, tree name, bool
> > want_type)> 
> >     /* Functions are found separately.  */
> >     continue;
> > 
> > -      if (!want_type || DECL_DECLARES_TYPE_P (decl))
> > +      if (DECL_DECLARES_TYPE_P (decl))
> > +   {
> > +     if (want_type)
> 
> We could also return immediately if !DECL_IMPLICIT_TYPEDEF_P.

I had a look, but this seems to break a few cases. For example:
(from g++.old-deja/g++.other/lookup23.C)

  struct a { int a; };
  struct b : a {};
  
  b x;
  
  void foo ()
  {
    x.a = 22;
  }

Breaks with "invalid use of 'a::a'"

        Thomas

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to