re PR c++/10446 (ICE on a definition of a nonexistent member function of a nested...
authorMark Mitchell <mark@codesourcery.com>
Tue, 22 Apr 2003 22:53:01 +0000 (22:53 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 22 Apr 2003 22:53:01 +0000 (22:53 +0000)
PR c++/10446
* search.c (lookup_fnfields_1): Handle empty slots in the method
vector.

PR c++/10446
* g++.dg/parse/crash3.C: New test.

From-SVN: r65962

gcc/cp/ChangeLog
gcc/cp/search.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/crash3.C [new file with mode: 0644]

index ec4684ddef209e1d9cba01771c441380bdd0d5b2..c768b4f2fe387c94a9c92a58a2bb93c2f5327506 100644 (file)
@@ -1,5 +1,9 @@
 2003-04-22  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/10446
+       * search.c (lookup_fnfields_1): Handle empty slots in the method
+       vector.
+       
        PR c++/10428
        * decl.c (check_elaborated_type_specifier): New function, split
        out from ...
index 433e1ac13ae046c4b6e5364604b9796711a12ced..b557fdfc26537c0dcee4e6158d992604094deb9d 100644 (file)
@@ -1400,9 +1400,14 @@ lookup_fnfields_1 (tree type, tree name)
                  n_outer_fields_searched++;
 #endif /* GATHER_STATISTICS */
 
-                 tmp = DECL_NAME (OVL_CURRENT (methods[i]));
-
-                 if (tmp > name)
+                 tmp = methods[i];
+                 /* This slot may be empty; we allocate more slots
+                    than we need.  In that case, the entry we're
+                    looking for is closer to the beginning of the
+                    list. */
+                 if (tmp)
+                   tmp = DECL_NAME (OVL_CURRENT (tmp));
+                 if (!tmp || tmp > name)
                    hi = i;
                  else if (tmp < name)
                    lo = i + 1;
index 35bbeb964068e86906a01dc7e90a16f0f58cc6be..154e129e0ae19cbf18c5898545d909e7094c9459 100644 (file)
@@ -1,5 +1,8 @@
 2003-04-22  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/10446
+       * g++.dg/parse/crash3.C: New test.
+
        PR c++/10428
        * g++.dg/parse/elab1.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/parse/crash3.C b/gcc/testsuite/g++.dg/parse/crash3.C
new file mode 100644 (file)
index 0000000..5a48ebc
--- /dev/null
@@ -0,0 +1,2 @@
+template <class T> struct L { struct I {}; };
+template <class T> void L<T>::I::foo() {} // { dg-error "" }