On 7/26/26 5:46 PM, Léo Hardt wrote:

On 2026-07-26 10:39, Jason Merrill wrote:
I'd also check seen_error () to make sure we've actually printed an error; we can also see ERROR_MARK in SFINAE cases where we haven't actually given an
error.

Thanks!
Below is an updated version of the patch

Finally applied, this, thanks!

Best regards,
Léo

---

On some input files, we might try to mangle names and
run into an ERROR_MARK. It would be redundantto 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]>
---
  gcc/cp/mangle.cc | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc
index 4ec57a54c34..e73714318e4 100644
--- a/gcc/cp/mangle.cc
+++ b/gcc/cp/mangle.cc
@@ -4063,6 +4063,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