Commit 20d65560 by Mark Mitchell Committed by Mark Mitchell

re PR c++/11928 (c++ typedef handling)

	PR c++/11928
	* search.c (add_conversions): Avoid adding two conversion
	operators for the same type.

	PR c++/11928
	* g++.dg/inherit/conv1.C: New test.

From-SVN: r70934
parent 4985cde3
2003-08-29 Mark Mitchell <mark@codesourcery.com>
PR c++/11928
* search.c (add_conversions): Avoid adding two conversion
operators for the same type.
2003-08-29 Richard Henderson <rth@redhat.com>
Jason Merrill <jason@redhat.com>
......
......@@ -2323,8 +2323,27 @@ add_conversions (tree binfo, void *data)
/* Make sure we don't already have this conversion. */
if (! IDENTIFIER_MARKED (name))
{
*conversions = tree_cons (binfo, tmp, *conversions);
IDENTIFIER_MARKED (name) = 1;
tree t;
/* Make sure that we do not already have a conversion
operator for this type. Merely checking the NAME is not
enough because two conversion operators to the same type
may not have the same NAME. */
for (t = *conversions; t; t = TREE_CHAIN (t))
{
tree fn;
for (fn = TREE_VALUE (t); fn; fn = OVL_NEXT (fn))
if (same_type_p (TREE_TYPE (name),
DECL_CONV_FN_TYPE (OVL_CURRENT (fn))))
break;
if (fn)
break;
}
if (!t)
{
*conversions = tree_cons (binfo, tmp, *conversions);
IDENTIFIER_MARKED (name) = 1;
}
}
}
return NULL_TREE;
......
2003-08-29 Mark Mitchell <mark@codesourcery.com>
PR c++/11928
* g++.dg/inherit/conv1.C: New test.
2003-08-29 Mark Mitchell <mark@codesourcery.com>
PR c++/6196
* g++.dg/ext/label1.C: New test.
* g++.dg/ext/label2.C: Likewise.
......
typedef struct _A A;
typedef struct _A B;
void some_function(B *b);
class AClass {
public:
operator A*() { return 0;}
};
class BClass :public AClass {
public:
operator B*() { return 0;}
};
int main(int argc, char **argv) {
BClass b;
some_function(b);
}
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