[Bug c++/94128] ICE on C++20 "requires requires" with lambda

2021-08-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94128

Andrew Pinski  changed:

   What|Removed |Added

 CC||dmusiienko at gmail dot com

--- Comment #6 from Andrew Pinski  ---
*** Bug 94333 has been marked as a duplicate of this bug. ***

[Bug c++/94128] ICE on C++20 "requires requires" with lambda

2020-05-29 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94128

Patrick Palka  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
   Target Milestone|--- |10.2

--- Comment #5 from Patrick Palka  ---
Fixed for GCC 10.2+.

[Bug c++/94128] ICE on C++20 "requires requires" with lambda

2020-05-29 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94128

--- Comment #4 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Patrick Palka
:

https://gcc.gnu.org/g:03c344ad180e094140be514a5e7cbaf95b5dcd2e

commit r10-8214-g03c344ad180e094140be514a5e7cbaf95b5dcd2e
Author: Patrick Palka 
Date:   Fri May 29 14:17:02 2020 -0400

c++: lambdas inside constraints [PR92652]

When parsing a constraint-expression, a requires-clause or a
requires-expression, we temporarily increment processing_template_decl
so that we always obtain template trees which we could later reduce via
substitution even when not inside a template.

But incrementing processing_template_decl when we're already inside a
template has the unintended side effect of shifting up the template
parameter levels of a lambda defined inside one of these constructs,
which leads to confusion later during substitution into the lambda.

This patch fixes this issue by incrementing processing_template_decl
during parsing of these constructs only if it is 0.

gcc/cp/ChangeLog:

PR c++/92652
PR c++/93698
PR c++/94128
* parser.c (cp_parser_requires_clause_expression): Temporarily
increment processing_template_decl only if it is 0.
(cp_parser_constraint_expression): Likewise.
(cp_parser_requires_expression): Likewise.

gcc/testsuite/ChangeLog:

PR c++/92652
PR c++/93698
PR c++/94128
* g++.dg/cpp2a/concepts-lambda8.C: New test.
* g++.dg/cpp2a/concepts-lambda9.C: New test.
* g++.dg/cpp2a/concepts-lambda10.C: New test.

(cherry picked from commit 020d86db8896f088435830595640e6fc21bc64ad)

[Bug c++/94128] ICE on C++20 "requires requires" with lambda

2020-05-29 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94128

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:020d86db8896f088435830595640e6fc21bc64ad

commit r11-723-g020d86db8896f088435830595640e6fc21bc64ad
Author: Patrick Palka 
Date:   Fri May 29 09:40:40 2020 -0400

c++: lambdas inside constraints [PR92652]

When parsing a constraint-expression, a requires-clause or a
requires-expression, we temporarily increment processing_template_decl
so that we always obtain template trees which we could later reduce via
substitution even when not inside a template.

But incrementing processing_template_decl when we're already inside a
template has the unintended side effect of shifting up the template
parameter levels of a lambda defined inside one of these constructs,
which leads to confusion later during substitution into the lambda.

This patch fixes this issue by incrementing processing_template_decl
during parsing of these constructs only if it is 0.

Passes 'make check-c++', and also tested by building cmcstl2, does this
look OK to commit after a full bootstrap/regtest?

gcc/cp/ChangeLog:

PR c++/92652
PR c++/93698
PR c++/94128
* parser.c (cp_parser_requires_clause_expression): Temporarily
increment processing_template_decl only if it is 0.
(cp_parser_constraint_expression): Likewise.
(cp_parser_requires_expression): Likewise.

gcc/testsuite/ChangeLog:

PR c++/92652
PR c++/93698
PR c++/94128
* g++.dg/cpp2a/concepts-lambda8.C: New test.
* g++.dg/cpp2a/concepts-lambda9.C: New test.
* g++.dg/cpp2a/concepts-lambda10.C: New test.

[Bug c++/94128] ICE on C++20 "requires requires" with lambda

2020-05-28 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94128

Patrick Palka  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
 Status|NEW |ASSIGNED
 CC||ppalka at gcc dot gnu.org

[Bug c++/94128] ICE on C++20 "requires requires" with lambda

2020-03-11 Thread bisqwit at iki dot fi
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94128

--- Comment #2 from Joel Yliluoma  ---
Yes, it is valid.

— The auto parameter is valid since C++20. It is called a “placeholder type”,
which has existed since C++11. C++20 made it valid also in function parameters.

— The “requires” is a valid keyword since C++20. It specifies constraints that
the parameter must match. The double “requires” manifests in certain
situations.

— Until C++20, lambdas were not permitted in unevaluated contexts. Changed in
C++20.

[Bug c++/94128] ICE on C++20 "requires requires" with lambda

2020-03-11 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94128

Martin Liška  changed:

   What|Removed |Added

Version|unknown |10.0
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2020-03-11
 CC||jason at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška  ---
Is it really a valid code?
Started to ICE with r10-3735-gcb57504a55015891, before that we rejected the
code:

pr94128.cc:1:11: warning: use of ‘auto’ in parameter declaration only available
with ‘-fconcepts’
1 | void test(auto param)
  |   ^~~~
pr94128.cc:2:3: error: ‘requires’ only available with ‘-fconcepts’
2 |   requires requires{ { [](auto p){return p;}(param) }; };
  |   ^~~~
pr94128.cc:2:12: error: ‘requires’ was not declared in this scope
2 |   requires requires{ { [](auto p){return p;}(param) }; };
  |^~~~
pr94128.cc: In function ‘void test(auto:1)’:
pr94128.cc:2:52: error: expected ‘;’ before ‘}’ token
2 |   requires requires{ { [](auto p){return p;}(param) }; };
  |^~