102610 – [C++23] P2036R3 - Change scope of lambda trailing-return-type (original) (raw)

| Comment 1 Marek Polacek 2022-08-16 16:16:52 UTC https://wg21.link/p2579r0, Mitigation strategies for P2036 ”Changing scope for lambda trailing-return-type”, was also approved. Comment 2 Jakub Jelinek 2023-08-31 11:38:44 UTC Related question for the last paper: https://github.com/cplusplus/draft/issues/6536 Other than that, I guess opening a new sk_lambda scope in cp_parser_lambda_declarator_opt at the start and leaving it at the end should be easy, but we only build_capture_proxy later on. Shall we pushdecl into the sk_lambda scope instead the LAMBDA_CAPTURE_EXPLICIT_P && !DECL_NORMAL_CAPTURE_P captures and somehow special-case them in name lookup or just finish_decltype_type where we currently handle the if (outer_automatic_var_p (expr) && current_function_decl && LAMBDA_FUNCTION_P (current_function_decl)) type = capture_decltype (expr); case? Though, in the lambda declarator, current_function_decl is still the containing function and outer_automatic_var_p also will not work. I guess we need some way to know whether we are in the lambda declarator (and also whether it is before the end of parameter declarations or after and whether in the latter case the lambda is mutable or not) and special case in that case both the init-captures and automatic? vars from the current function (which will be outer vars in lambda body). | | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |