public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed] c++: constrained lambda error-recovery [PR108972]
@ 2023-03-10 18:49 Jason Merrill
  2023-03-14  7:54 ` [PATCH] testsuite: Fix up g++.dg/cpp2a/concepts-lambda3.C [PR108972] Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Merrill @ 2023-03-10 18:49 UTC (permalink / raw)
  To: gcc-patches

Tested x86_64-pc-linux-gnu, applying to trunk.

-- 8< --

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.
---
 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;
 }
-

base-commit: e1c8cf9006bd278e969ab7ed35178067ce128f32
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] testsuite: Fix up g++.dg/cpp2a/concepts-lambda3.C [PR108972]
  2023-03-10 18:49 [pushed] c++: constrained lambda error-recovery [PR108972] Jason Merrill
@ 2023-03-14  7:54 ` Jakub Jelinek
  2023-03-14 14:34   ` Jason Merrill
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2023-03-14  7:54 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

Hi!

On Fri, Mar 10, 2023 at 01:49:38PM -0500, Jason Merrill via Gcc-patches wrote:
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/cpp2a/concepts-lambda3.C: Run at lower std levels,
> 	but expect errors.

I'm seeing
+UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++11 compilation failed to produce executable
+UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++14 compilation failed to produce executable
+UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++17 compilation failed to produce executable
+UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++98 compilation failed to produce executable
with this change, and if I test with
GXX_TESTSUITE_STDS=98,11,14,17,20,2b make check-g++ -k RUNTESTFLAGS="--target_board=unix\{-m32,-m64,-m64/-fconcepts\} dg.exp=concepts-lambda3.C"
I see even FAILs for the -fconcepts case, so apparently even -std=c++17
-fconcepts isn't enough to make it compile without errors.

The following patch will expect errors for all of c++17_down and will
make the test dg-do compile for that case too, such that the UNRESOLVED
stuff is gone.

Ok for trunk?

2023-03-14  Jakub Jelinek  <jakub@redhat.com>

	PR c++/108972
	* g++.dg/cpp2a/concepts-lambda3.C: Use dg-do run only for c++20,
	for c++17_down dg-do compile.  Expect dg-excess-errors for c++17_down
	rather than ! concepts.

--- gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C.jj	2023-03-13 23:01:42.082959131 +0100
+++ gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C	2023-03-14 08:48:12.834128044 +0100
@@ -1,5 +1,6 @@
-// { dg-do run }
-// { dg-excess-errors "" { target { ! concepts } } } (PR108972)
+// { dg-do run { target c++20 } }
+// { dg-do compile { target c++17_down } }
+// { dg-excess-errors "" { target { c++17_down } } } (PR108972)
 
 template<typename T>
 concept C1 = __is_same_as(T, int)


	Jakub


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] testsuite: Fix up g++.dg/cpp2a/concepts-lambda3.C [PR108972]
  2023-03-14  7:54 ` [PATCH] testsuite: Fix up g++.dg/cpp2a/concepts-lambda3.C [PR108972] Jakub Jelinek
@ 2023-03-14 14:34   ` Jason Merrill
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2023-03-14 14:34 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On 3/14/23 03:54, Jakub Jelinek wrote:
> Hi!
> 
> On Fri, Mar 10, 2023 at 01:49:38PM -0500, Jason Merrill via Gcc-patches wrote:
>> gcc/testsuite/ChangeLog:
>>
>> 	* g++.dg/cpp2a/concepts-lambda3.C: Run at lower std levels,
>> 	but expect errors.
> 
> I'm seeing
> +UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++11 compilation failed to produce executable
> +UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++14 compilation failed to produce executable
> +UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++17 compilation failed to produce executable
> +UNRESOLVED: g++.dg/cpp2a/concepts-lambda3.C  -std=c++98 compilation failed to produce executable
> with this change, and if I test with
> GXX_TESTSUITE_STDS=98,11,14,17,20,2b make check-g++ -k RUNTESTFLAGS="--target_board=unix\{-m32,-m64,-m64/-fconcepts\} dg.exp=concepts-lambda3.C"
> I see even FAILs for the -fconcepts case, so apparently even -std=c++17
> -fconcepts isn't enough to make it compile without errors.
> 
> The following patch will expect errors for all of c++17_down and will
> make the test dg-do compile for that case too, such that the UNRESOLVED
> stuff is gone.
> 
> Ok for trunk?

OK.

> 2023-03-14  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR c++/108972
> 	* g++.dg/cpp2a/concepts-lambda3.C: Use dg-do run only for c++20,
> 	for c++17_down dg-do compile.  Expect dg-excess-errors for c++17_down
> 	rather than ! concepts.
> 
> --- gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C.jj	2023-03-13 23:01:42.082959131 +0100
> +++ gcc/testsuite/g++.dg/cpp2a/concepts-lambda3.C	2023-03-14 08:48:12.834128044 +0100
> @@ -1,5 +1,6 @@
> -// { dg-do run }
> -// { dg-excess-errors "" { target { ! concepts } } } (PR108972)
> +// { dg-do run { target c++20 } }
> +// { dg-do compile { target c++17_down } }
> +// { dg-excess-errors "" { target { c++17_down } } } (PR108972)
>   
>   template<typename T>
>   concept C1 = __is_same_as(T, int)
> 
> 
> 	Jakub
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-14 14:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 18:49 [pushed] c++: constrained lambda error-recovery [PR108972] Jason Merrill
2023-03-14  7:54 ` [PATCH] testsuite: Fix up g++.dg/cpp2a/concepts-lambda3.C [PR108972] Jakub Jelinek
2023-03-14 14:34   ` 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).