On 09/22/2011 05:11 PM, Fabien Chêne wrote:
2011/9/22 Jason Merrill<ja...@redhat.com>:
I don't, it just seemed strange to handle functions differently from other
decls here. But when I look more closely I see that we're in
lookup_field_1, which isn't interested in functions, so I guess we do want
to ignore function using-declarations here.
That's strange because if we do return FUNCTION_DECL, PR c++/30195 seems solved.
It works for that testcase, but we need to handle functions in
lookup_fnfields_1 since it's also called from other places.
But check for is_overloaded_fn rather than just OVERLOAD. Also, it looks like
the new code doesn't respect want_type.
Er, I'm a bit lost, do you mean something like that ?
if (TREE_CODE (field) == USING_DECL)
{
tree target_field = strip_using_decl (field);
if (target_field != field)
{
if (DECL_P (target_field)&& DECL_NAME (target_field) == name
|| (is_overloaded_fn (target_field)
&& DECL_NAME (get_first_fn (target_field)) == name))
{
if (!want_type
|| TREE_CODE (target_field) == TYPE_DECL)
return target_field;
}
continue;
}
}
I was thinking more like
tree decl = field;
if (TREE_CODE (decl) == USING_DECL)
{
decl = strip_using_decl (decl);
if (is_overloaded_fn (decl)) continue;
}
if (DECL_NAME (decl) == name
...
Jason