diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ec4684ddef209e1d9cba01771c441380bdd0d5b2..c768b4f2fe387c94a9c92a58a2bb93c2f5327506 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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 ...
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 433e1ac13ae046c4b6e5364604b9796711a12ced..b557fdfc26537c0dcee4e6158d992604094deb9d 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 35bbeb964068e86906a01dc7e90a16f0f58cc6be..154e129e0ae19cbf18c5898545d909e7094c9459 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000000000000000000000000000000000000..5a48ebc7cc7c3a1d1e6d3b78943a92cb30fa0334
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash3.C
@@ -0,0 +1,2 @@
+template <class T> struct L { struct I {}; };
+template <class T> void L<T>::I::foo() {} // { dg-error "" }