Commit c566721f by Giovanni Bajo

re PR c++/15967 (ICE on ambiguous operator new in class hierarchy)

	PR c++/15967
	* search.c (lookup_field): Propagate the ambiguity list.
	(lookup_fnfields): Likewise.

	PR c++/15967
	* g++.dg/lookup/crash3.C: New test.

From-SVN: r83158
parent 4e0f4df5
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.
......
......@@ -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;
......
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.
......
// { 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" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment