mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
c++: > in lambda in template arg [PR107953]
As with PR116928, we need to set greater_than_is_operator_p within the lambda delimiters. PR c++/107953 gcc/cp/ChangeLog: * parser.cc (cp_parser_lambda_expression): Set greater_than_is_operator_p. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-targ18.C: New test.
This commit is contained in:
@@ -11806,6 +11806,8 @@ cp_parser_lambda_expression (cp_parser* parser,
|
||||
it now. */
|
||||
push_deferring_access_checks (dk_no_deferred);
|
||||
|
||||
auto gr = make_temp_override (parser->greater_than_is_operator_p, true);
|
||||
|
||||
if (!consteval_block_p)
|
||||
{
|
||||
cp_parser_lambda_introducer (parser, lambda_expr);
|
||||
|
||||
13
gcc/testsuite/g++.dg/cpp2a/lambda-targ18.C
Normal file
13
gcc/testsuite/g++.dg/cpp2a/lambda-targ18.C
Normal file
@@ -0,0 +1,13 @@
|
||||
// PR c++/107953
|
||||
// { dg-do compile { target c++20 } }
|
||||
|
||||
template<auto F>
|
||||
struct Foo {};
|
||||
|
||||
Foo<[](){ return 1 >= 0; }> foo1{};
|
||||
|
||||
Foo<[](){ return (1 > 0); }> foo2{};
|
||||
|
||||
Foo<[](){ return 1 > 0; }> foo3{};
|
||||
|
||||
Foo<[g = 1 > 0]{ return g; }> foo4{};
|
||||
Reference in New Issue
Block a user