search.c (lookup_field_r): Remove obsolete code for type-named field in PoD.
authorNathan Sidwell <nathan@acm.org>
Mon, 21 Aug 2017 18:57:06 +0000 (18:57 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Mon, 21 Aug 2017 18:57:06 +0000 (18:57 +0000)
* search.c (lookup_field_r): Remove obsolete code for type-named
field in PoD.

From-SVN: r251243

gcc/cp/ChangeLog
gcc/cp/search.c

index 04edd57..dd94fdb 100644 (file)
@@ -1,5 +1,8 @@
 2017-08-21  Nathan Sidwell  <nathan@acm.org>
 
+       * search.c (lookup_field_r): Remove obsolete code for type-named
+       field in PoD.
+
        * search.c (lookup_field_1): Assert TYPE is a class and VFIELD
        isn't special.
        (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
index a1c4ba1..6628a1b 100644 (file)
@@ -1111,39 +1111,22 @@ lookup_field_r (tree binfo, void *data)
        nval = dep_using;
     }
 
-  /* If there is no declaration with the indicated name in this type,
-     then there's nothing to do.  */
-  if (!nval)
-    goto done;
-
   /* If we're looking up a type (as with an elaborated type specifier)
      we ignore all non-types we find.  */
-  if (lfi->want_type && !DECL_DECLARES_TYPE_P (nval))
+  if (lfi->want_type && nval && !DECL_DECLARES_TYPE_P (nval))
     {
-      if (lfi->name == TYPE_IDENTIFIER (type))
-       {
-         /* If the aggregate has no user defined constructors, we allow
-            it to have fields with the same name as the enclosing type.
-            If we are looking for that name, find the corresponding
-            TYPE_DECL.  */
-         for (nval = TREE_CHAIN (nval); nval; nval = TREE_CHAIN (nval))
-           if (DECL_NAME (nval) == lfi->name
-               && TREE_CODE (nval) == TYPE_DECL)
-             break;
-       }
-      else
-       nval = NULL_TREE;
-      if (!nval && CLASSTYPE_NESTED_UTDS (type) != NULL)
-       {
-         binding_entry e = binding_table_find (CLASSTYPE_NESTED_UTDS (type),
-                                               lfi->name);
-         if (e != NULL)
-           nval = TYPE_MAIN_DECL (e->type);
-         else
-           goto done;
-       }
+      nval = NULL_TREE;
+      if (CLASSTYPE_NESTED_UTDS (type))
+       if (binding_entry e = binding_table_find (CLASSTYPE_NESTED_UTDS (type),
+                                                 lfi->name))
+         nval = TYPE_MAIN_DECL (e->type);
     }
 
+  /* If there is no declaration with the indicated name in this type,
+     then there's nothing to do.  */
+  if (!nval)
+    goto done;
+
   /* If the lookup already found a match, and the new value doesn't
      hide the old one, we might have an ambiguity.  */
   if (lfi->rval_binfo