public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6594] c++: constrained lambda error-recovery [PR108972]
@ 2023-03-10 18:49 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2023-03-10 18:49 UTC (permalink / raw)
  To: gcc-cvs

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

commit r13-6594-ga915c29a7d63ccb88cfded75ba1c8c4919845e98
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Mar 9 17:01:48 2023 -0500

    c++: constrained lambda error-recovery [PR108972]
    
    Better not to ICE after various valid errors.
    
            PR c++/108972
    
    gcc/cp/ChangeLog:
    
            * lambda.cc (compare_lambda_template_head): Check more
            for error_mark_node.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp2a/concepts-lambda3.C: Run at lower std levels,
            but expect errors.

Diff:
---
 gcc/cp/lambda.cc                              | 4 ++++
 gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc
index c752622816d..212990a21bf 100644
--- a/gcc/cp/lambda.cc
+++ b/gcc/cp/lambda.cc
@@ -1537,6 +1537,8 @@ compare_lambda_template_head (tree tmpl_a, tree tmpl_b)
 	  if (parm_a == error_mark_node)
 	    return false;
 	  parm_a = TREE_VALUE (parm_a);
+	  if (parm_a == error_mark_node)
+	    return false;
 	  if (DECL_VIRTUAL_P (parm_a))
 	    parm_a = NULL_TREE;
 	}
@@ -1548,6 +1550,8 @@ compare_lambda_template_head (tree tmpl_a, tree tmpl_b)
 	  if (parm_b == error_mark_node)
 	    return false;
 	  parm_b = TREE_VALUE (parm_b);
+	  if (parm_b == error_mark_node)
+	    return false;
 	  if (DECL_VIRTUAL_P (parm_b))
 	    parm_b = NULL_TREE;
 	}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C
index 291e451ca1a..b18e6b62aa4 100644
--- a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C
@@ -1,4 +1,5 @@
-// { dg-do run { target c++20 } }
+// { dg-do run }
+// { dg-excess-errors "" { target { ! concepts } } } (PR108972)
 
 template<typename T>
 concept C1 = __is_same_as(T, int)
@@ -61,4 +62,3 @@ int main(int, char**)
 
   return 0;
 }
-

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-10 18:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 18:49 [gcc r13-6594] c++: constrained lambda error-recovery [PR108972] Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).