https://gcc.gnu.org/g:fb8fe91d8ec4a4949fc8c81e56c99b31a416086c

commit r17-4043-gfb8fe91d8ec4a4949fc8c81e56c99b31a416086c
Author: Léo Hardt <[email protected]>
Date:   Sun Jul 26 18:46:35 2026 -0300

    c++: avoid redundant 'sorry' message.
    
    On some input files, we might try to mangle names and
    run into an ERROR_MARK. It would be redundant to print
    a "sorry, unimplemented: mangling error mark" message,
    since an error has already been printed to the user.
    
    See the following code as an example:
    
      template<int... i> void f() {
      (..., []() requires(i) { i; });
      }
      int main() { f<0,1,2>(); }
    
    gcc/cp/ChangeLog:
    
            * mangle.cc (write_expression): don't call
            sorry when mangling error caused by previously
            seen error.
    
    Signed-off-by: Léo Hardt <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>

Diff:
---
 gcc/cp/mangle.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc
index b2697f27c329..e90ea00c83f6 100644
--- a/gcc/cp/mangle.cc
+++ b/gcc/cp/mangle.cc
@@ -4077,6 +4077,10 @@ write_expression (tree expr)
                     "use library traits instead", expr);
              break;
 
+           case ERROR_MARK:
+             if (seen_error ())
+               break;
+             /* FALLTHROUGH */
            default:
              sorry ("mangling %C", code);
              break;

Reply via email to