On Tue, 2 Dec 2025, Jason Merrill wrote: > On 12/2/25 3:37 AM, Egas Ribeiro wrote: > > On 2025-12-01 15:34, Patrick Palka wrote: > > > Hi Egas, thanks for tackling this bug! > > > > > > On Sun, 30 Nov 2025, Egas Ribeiro wrote: > > > > > > > Regtested on x86_64-pc-linux-gnu, OK for trunk? > > > > > > > > -- >8 -- > > > > > > > > When checking a deleted explicit specialization in a SFINAE context, > > > > we were failing to propagate the error from mark_used. The call to > > > > resolve_nondeduced_context in convert_to_void correctly returned > > > > error_mark_node, > > > > > > I wonder actually whether resolve_nondeduced_context is correct to > > > return error_mark_node in this case. Sure the single X::g<0> > > > overload selected by resolve_nondeduced_context is deleted, but > > > should that imply an ODR-use of the overload? Maybe it should be the > > > responsibility of the caller to call mark_used, and we should remove the > > > mark_used in resolve_nondeduced_context. > > > > > > Note that resolve_nondeduced_context does not call mark_used when > > > the overload set is _not_ a template-id. So the caller will likely > > > have to call mark_used anyway to uniformly handle template-id and > > > non-template-id overloads. > > > > > > Jason, what do you think? > > > > > > > + if (expr == error_mark_node) > > > > + return false; > > > > > > If the above approach doesn't sound right then I agree that > > > mark_single_function as well as mark_used should return false > > > for error_mark_node. > > > > I looked into the usage for this case and I agree with Patrick. The > > comment on resolve_nondeduced_context cites DR 115 which is just about > > resolving a template-id to its specialization, nothing about ODR-use. > > So the mark_used call there seems out of place. That said, I think > > mark_single_function should still check for error_mark_node anyway, > > unless i understood something wrong about its usage. > > Currently mark_used doesn't return false for error_mark_node, and > mark_single_function should be consistent with mark_used. I'm open to trying > returing false from both, but not just one. > > I also agree that the mark_used in resolve_nondeduced_context seems out of > place, and the caller should handle the marking, whether with a call to > mark_single_function or otherwise. Does removing the mark_used break > anything?
That seems sufficient to fix the PR as well. Egas, wanna submit a patch taking that approach? > > > Happy to do whichever approach you prefer. > > > >
