Commit Graph

4 Commits

Author SHA1 Message Date
William S Fulton 3fc35e05f2 C++20 lambdas: accept prefix and trailing form with return type requires-clauses
cpp_lambda_decl now slots requires_clause_opt after lambda_template (in
all three productions) and after the trailing return type in form 2.
This lifts two parse limitations on templated lambdas:

  []<typename T> requires Numeric<T> (T x) { ... }       // prefix form
  []<typename T>(T x) -> T requires Numeric<T> { ... }   // with return type

The captured constraint subtree is discarded - lambdas are not wrapped,
matching how form 2 already discards cpp_const's constraint_node.
2026-05-12 23:04:20 +01:00
Olly Betts 40033f8498 Fix parsing of <= and >= in templated lambda
Skipping between matching delimiters is now done at the token level
rather than the character level.

Partly addresses #2630
2023-06-07 15:46:20 +12:00
Olly Betts 379d5b6742 Fix warning suppression in cpp20_lambda_template 2022-07-29 16:29:32 +12:00
Olly Betts 88f227b5da Add testcase 2022-07-27 09:30:39 +12:00