diff options
author | giovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-15 01:46:21 +0000 |
---|---|---|
committer | giovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-15 01:46:21 +0000 |
commit | 5bf15077a5f177ac2db7e6ae2dcb173f5c978c27 (patch) | |
tree | 91d0c8dd9e53f1a3ff47738322bdf184f3022066 | |
parent | 9ed82c659d9d4e38a07ba7916f3949723ae46313 (diff) | |
download | gcc-5bf15077a5f177ac2db7e6ae2dcb173f5c978c27.tar.gz |
PR c++/15967
* search.c (lookup_field): Propagate the ambiguity list.
(lookup_fnfields): Likewise.
PR c++/15967
* g++.dg/lookup/crash3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83158 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/search.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/crash3.C | 15 |
4 files changed, 32 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7148f222edc..1fc8ec0fbab 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2004-06-14 Giovanni Bajo <giovannibajo@gcc.gnu.org> + PR c++/15967 + * search.c (lookup_field): Propagate the ambiguity list. + (lookup_fnfields): Likewise. + +2004-06-14 Giovanni Bajo <giovannibajo@gcc.gnu.org> + PR c++/15947 * parser.c (cp_parser_template_name): Ctors/dtors never need a template keyword to disambiguate. diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 5f4c91c3ec0..ca86b13dedb 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1332,8 +1332,9 @@ lookup_field (tree xbasetype, tree name, int protect, bool want_type) { tree rval = lookup_member (xbasetype, name, protect, want_type); - /* Ignore functions. */ - if (rval && BASELINK_P (rval)) + /* Ignore functions, but propagate the ambiguity list. */ + if (!error_operand_p (rval) + && (rval && BASELINK_P (rval))) return NULL_TREE; return rval; @@ -1347,8 +1348,9 @@ lookup_fnfields (tree xbasetype, tree name, int protect) { tree rval = lookup_member (xbasetype, name, protect, /*want_type=*/false); - /* Ignore non-functions. */ - if (rval && !BASELINK_P (rval)) + /* Ignore non-functions, but propagate the ambiguity list. */ + if (!error_operand_p (rval) + && (rval && !BASELINK_P (rval))) return NULL_TREE; return rval; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7ec7738ddee..79a84175526 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2004-06-14 Giovanni Bajo <giovannibajo@gcc.gnu.org> + PR c++/15967 + * g++.dg/lookup/crash3.C: New test. + +2004-06-14 Giovanni Bajo <giovannibajo@gcc.gnu.org> + PR c++/15947 * g++.dg/parse/dtor4.C: New test. diff --git a/gcc/testsuite/g++.dg/lookup/crash3.C b/gcc/testsuite/g++.dg/lookup/crash3.C new file mode 100644 index 00000000000..ef025fa76aa --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/crash3.C @@ -0,0 +1,15 @@ +// { dg-do compile } +// Contributed by Wolfgang Wieser <wwieser at gmx dot de> +// PR c++/15967: ICE with ambiguous operator new + +typedef unsigned int size_t; + +struct A { void *operator new(size_t s){} }; // { dg-error "operator new" } +struct B { void *operator new(size_t s){} }; // { dg-error "operator new" } + +struct C : A,B {}; + +int crash() +{ + C *c=new C(); // { dg-error "ambiguous" } +} |