On 3/1/21 5:11 PM, Anthony Sharp wrote:
Hi all,
Here is the patch as promised. Regression tested on the c++ side and
everything seems okay. Compiles fine.
Sounds good, though strip_using_decl (parent_field) may be overloaded if
the using-decl brings in multiple functions with that name.
Could you give my new regression test a quick glance over then just to
make sure I've not forgotten about something? It definitely seems to
work but I'm no expert in all the different ways using statements can be
constructed. If you were to use 'using comma' (in the testcase), it
generates another error because it's ambiguous, so that's okay. And if
you use a comma-separated list like I have in the test (i.e. using
A2::comma, A1::comma) it seems to find the correct bits just fine.
Unless I'm getting really lucky and it's actually just a coincidence.
It seems that strip_using_decl doesn't return an overloaded list. Or, if
it does, the first entry in that list just so happens to always be the
right answer, so it can be treated like it's a regular decl for this
purpose. For example, even if we change up the order of baseclasses,
using statements and class definitions, it still seems to work, e.g. the
following *seems* to work just fine:
That's because none of the names are overloaded within a single base
class. But if I add
class A2
{
protected:
int separate(int a);
int comma(int a);
int alone;
};
class A1
{
protected:
int separate();
int separate(int,int,int);
then strip_using_decl for A1::separate gives an OVERLOAD.
You can iterate over the result of strip_using decl with the
for (ovl_iterator iter (fns); iter; ++iter)
{
tree fn = *iter;
pattern.
Also, you can use == instead of cp_tree_equal for comparing FUNCTION_DECLs.
Jason