OSDN Git Service

PR c++/10446
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Apr 2003 22:53:01 +0000 (22:53 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Apr 2003 22:53:01 +0000 (22:53 +0000)
* search.c (lookup_fnfields_1): Handle empty slots in the method
vector.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65962 138bc75d-0d04-0410-961f-82ee72b054a4

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

index ec4684d..c768b4f 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 433e1ac..b557fdf 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 35bbeb9..154e129 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 "" }