* valops.c (value_struct_elt_for_reference): Do not rely on
authorDaniel Jacobowitz <drow@false.org>
Fri, 4 Dec 2009 20:26:33 +0000 (20:26 +0000)
committerDaniel Jacobowitz <drow@false.org>
Fri, 4 Dec 2009 20:26:33 +0000 (20:26 +0000)
field order.

gdb/ChangeLog
gdb/valops.c

index 461b01addcf5d4d5bd8b194f2b1bebd3129e2987..375f968331373d0f70c2615544af49f87b5cbb4b 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-04  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * valops.c (value_struct_elt_for_reference): Do not rely on
+       field order.
+
 2009-12-03  Richard Ward  <richard.j.ward1@googlemail.com>
 
        * python/py-type.c (convert_field): New attribute "is_base_class".
index 34619d34def6188ec1417fbcb0d7fc0f6862ec8b..99c99f180be2f10c84382228960c407a7518ea89 100644 (file)
@@ -2700,29 +2700,31 @@ value_struct_elt_for_reference (struct type *domain, int offset,
                }
 
              if (j == len)
-               error (_("no member function matches that type instantiation"));            }
+               error (_("no member function matches that type instantiation"));
+           }
          else
            {
              int ii;
-             /* Skip artificial methods.  This is necessary if, for example,
-                the user wants to "print subclass::subclass" with only
-                one user-defined constructor.  There is no ambiguity in this
-                case.  */
+
+             j = -1;
              for (ii = 0; ii < TYPE_FN_FIELDLIST_LENGTH (t, i);
                   ++ii)
                {
+                 /* Skip artificial methods.  This is necessary if,
+                    for example, the user wants to "print
+                    subclass::subclass" with only one user-defined
+                    constructor.  There is no ambiguity in this
+                    case.  */
                  if (TYPE_FN_FIELD_ARTIFICIAL (f, ii))
-                   --len;
-               }
+                   continue;
 
-             /* Desired method is ambiguous if more than one method is
-                defined.  */
-             if (len > 1)
-               error (_("non-unique member `%s' requires type instantiation"), name);
+                 /* Desired method is ambiguous if more than one
+                    method is defined.  */
+                 if (j != -1)
+                   error (_("non-unique member `%s' requires type instantiation"), name);
 
-             /* This assumes, of course, that all artificial methods appear
-                BEFORE any concrete methods.  */
-             j = TYPE_FN_FIELDLIST_LENGTH (t, i) - 1;
+                 j = ii;
+               }
            }
 
          if (TYPE_FN_FIELD_STATIC_P (f, j))