On 11/19/23 16:44, waffl3x wrote:





On Sunday, November 19th, 2023 at 1:34 PM, Jason Merrill <ja...@redhat.com> 
wrote:




On 11/19/23 13:36, waffl3x wrote:

I'm having trouble fixing the error for this case, the control flow
when the functions are overloaded is much more complex.

struct S {
void f(this S&) {}
void f(this S&, int)

void g() {
void (*fp)(S&) = &f;
}
};

This seemed to have fixed the non overloaded case, but I'm also not
very happy with it, it feels kind of icky. Especially since the expr's
location isn't available here, although, it just occurred to me that
the expr's location is probably stored in the node.

typeck.cc:cp_build_addr_expr_1
```
case BASELINK:
arg = BASELINK_FUNCTIONS (arg);
if (DECL_XOBJ_MEMBER_FUNC_P (
{
error ("You must qualify taking address of xobj member functions");
return error_mark_node;
}


The loc variable was set earlier in the function, you can use that.

Will do.

The overloaded case we want to handle here in
resolve_address_of_overloaded_function:

if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
&& !(complain & tf_ptrmem_ok) && !flag_ms_extensions)
{
static int explained;

if (!(complain & tf_error))
return error_mark_node;

auto_diagnostic_group d;
if (permerror (input_location, "assuming pointer to member %qD", fn)
&& !explained)
{
inform (input_location, "(a pointer to member can only be "
"formed with %<&%E%>)", fn);
explained = 1;
}
}


Jason

I'll check that out now, I just mostly finished the first lambda crash.

What is the proper way to error out of instantiate_body? What I have
right now is just not recursing down further if theres a problem. Also,
I'm starting to wonder if I should actually be erroring in
instantiate_decl instead.

I think you want to error in start_preparsed_function, to handle template and non-template cases in the same place.

Jason

Reply via email to