https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121291
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathaniel Shead <nsh...@gcc.gnu.org>: https://gcc.gnu.org/g:bfb8615031a8c23df814d011567735093e3c1ac6 commit r16-2652-gbfb8615031a8c23df814d011567735093e3c1ac6 Author: Nathaniel Shead <nathanielosh...@gmail.com> Date: Tue Jul 29 22:20:32 2025 +1000 c++: Don't assume trait funcs return error_mark_node when tf_error is passed [PR121291] For the sake of determining if there are other errors in user code to report early, many trait functions don't always return error_mark_node if not called in a SFINAE context (i.e., tf_error is set). This patch removes some assumptions on this behaviour I'd made when improving diagnostics of builtin traits. PR c++/121291 gcc/cp/ChangeLog: * constraint.cc (diagnose_trait_expr): Remove assumption about failures returning error_mark_node. * except.cc (explain_not_noexcept): Allow expr not being noexcept. * method.cc (build_invoke): Adjust comment. (is_trivially_xible): Always note non-trivial components if expr is not null or error_mark_node. (is_nothrow_xible): Likewise for non-noexcept components. (is_nothrow_convertible): Likewise. gcc/testsuite/ChangeLog: * g++.dg/ext/is_invocable7.C: New test. * g++.dg/ext/is_nothrow_convertible5.C: New test. Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com> Reviewed-by: Patrick Palka <ppa...@redhat.com>