On Tue, Oct 19, 2021 at 10:48:04AM -0400, Jason Merrill wrote: > What if we use NULL_TREE for the error case instead of error_mark_node, i.e. > > - DECL_LOCAL_DECL_ALIAS (decl) = alias; > + if (alias != error_mark_node) > + DECL_LOCAL_DECL_ALIAS (decl) = alias; > > ? That ought to avoid the need to change other functions, since they > already check for null.
True, but I'm worried about e.g. maybe_version_functions which does if (DECL_LOCAL_DECL_P (olddecl)) { olddecl = DECL_LOCAL_DECL_ALIAS (olddecl); maybe_mark_function_versioned (olddecl); } (I think the above will crash of DECL_LOCAL_DECL_ALIAS is NULL) and if (DECL_LOCAL_DECL_P (newdecl)) { /* Unfortunately, we can get here before pushdecl naturally calls push_local_extern_decl_alias, so we need to call it directly. */ if (!DECL_LOCAL_DECL_ALIAS (newdecl)) push_local_extern_decl_alias (newdecl); newdecl = DECL_LOCAL_DECL_ALIAS (newdecl); maybe_mark_function_versioned (newdecl); } which means that if there is an error from push_local_extern_decl_alias, we'd report it twice rather than once (once from here, another time from do_pushdecl). I'm afraid maybe_version_functions needs fixing no matter what, but the NULL vs. error_mark_node decision is probably dependent on whether it is ok to error twice or not. Jakub