A type constrained 'auto' parameter (e.g. 'Numeric auto') is now
accepted in parameter type position - via a new
'idcolon AUTO parameter_declarator' alternative in parm_no_dox. The
invented type template parameter generated for each such auto parm
carries the type-constraint as a 'concept-id' constraint atom on its
'constraint' attribute, matching the requires-clause infrastructure
already used by explicit templates.
int twice_numeric(Numeric auto x) { return x + x; }
%template(twice_numeric_int) twice_numeric<int>;
Each constrained auto parm gets its own invented type template parameter
and constraint, so multi parm forms work too:
double scale_mixed(Numeric auto x, Numeric auto factor);
int add_same_concept(Sized auto a, Sized auto b);
cpp20_concepts_lambda.i picks up the constrained auto lambda case
('[](Numeric auto x){}') that previously failed to parse.
Assisted-by: Claude Code (Opus 4.7)
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.
Add testcases for concept constrained overload by arity, member operator
overloads, structural partial specialization with a requires-clause, and
the concept only function template redefinition that trips warning 302
(errors/cpp_concept_redefinition). Document existing support for
constrained class templates and member function templates of plain
classes, and the limitations around constraint subsumption: same-
signature templates differing only by requires-clause are dropped, and
concept only "partial specializations" are not selected.
Assisted-by: Claude Code (Opus 4.7)