From ae2196c28e9fe2cd9291f4d8e7a040da04a72085 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 22 Apr 2003 22:53:01 +0000 Subject: re PR c++/10446 (ICE on a definition of a nonexistent member function of a nested class in a class template) 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 | 4 ++++ gcc/cp/search.c | 11 ++++++++--- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/parse/crash3.C | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/parse/crash3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ec4684d..c768b4f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2003-04-22 Mark Mitchell + 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 433e1ac..b557fdf 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 35bbeb9..154e129e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2003-04-22 Mark Mitchell + 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 0000000..5a48ebc --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash3.C @@ -0,0 +1,2 @@ +template struct L { struct I {}; }; +template void L::I::foo() {} // { dg-error "" } -- cgit v1.1