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
This commit is contained in:
parent
4985cde3ef
commit
20d6556070
4 changed files with 55 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
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;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
23
gcc/testsuite/g++.dg/inherit/conv1.C
Normal file
23
gcc/testsuite/g++.dg/inherit/conv1.C
Normal file
|
@ -0,0 +1,23 @@
|
|||
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);
|
||||
}
|
Loading…
Add table
Reference in a new issue