https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <[email protected]>: https://gcc.gnu.org/g:bae0ed69e1862add152f1b0618148f931611a9ca commit r16-5967-gbae0ed69e1862add152f1b0618148f931611a9ca Author: Egas Ribeiro <[email protected]> Date: Sun Dec 7 23:35:00 2025 +0000 c++: Fix SFINAE for deleted explicit specializations [PR119343] When checking a deleted explicit specialization in a SFINAE context, we were incorrectly selecting a partial specialization because resolve_nondeduced_context was calling mark_used. But resolving an overload to a single function (per DR 115) does not constitute ODR-use, so mark_used shouldn't be called there. Instead callers should call mark_used or mark_single_function on the result to uniformly handle all resolvable overloads (even non-template-id ones). This turns out to fix the below testcase because it causes convert_to_void for void(X::template g<0>) to properly propagate ODR-use failure (due to deleted g<0>) and return error_mark_node instead of returning void_node. PR c++/119343 gcc/cp/ChangeLog: * pt.cc (resolve_nondeduced_context): Remove mark_used call. gcc/testsuite/ChangeLog: * g++.dg/template/sfinae-deleted-pr119343.C: New test. Signed-off-by: Egas Ribeiro <[email protected]> Reviewed-by: Patrick Palka <[email protected]>
