tree lambda_return_type (tree expr) { if (expr == NULL_TREE) return void_type_node; if (type_unknown_p (expr) || BRACE_ENCLOSED_INITIALIZER_P (expr)) { cxx_incomplete_type_error (expr, TREE_TYPE (expr)); return void_type_node; } gcc_checking_assert (!type_dependent_expression_p (expr)); return cv_unqualified (type_decays_to (unlowered_expr_type (expr))); }
tree lambda_capture_field_type (tree expr, bool explicit_init_p) { tree type; if (explicit_init_p) { type = make_auto (); type = do_auto_deduction (type, expr, type); } else type = non_reference (unlowered_expr_type (expr)); if (type_dependent_expression_p (expr) && !is_this_parameter (tree_strip_nop_conversions (expr))) { type = cxx_make_type (DECLTYPE_TYPE); DECLTYPE_TYPE_EXPR (type) = expr; DECLTYPE_FOR_LAMBDA_CAPTURE (type) = true; DECLTYPE_FOR_INIT_CAPTURE (type) = explicit_init_p; SET_TYPE_STRUCTURAL_EQUALITY (type); } return type; }
tree lambda_capture_field_type (tree expr, bool explicit_init_p) { tree type; if (explicit_init_p) { type = make_auto (); type = do_auto_deduction (type, expr, type); } else type = non_reference (unlowered_expr_type (expr)); if (!type || WILDCARD_TYPE_P (type) || type_uses_auto (type) || DECL_PACK_P (expr)) { type = cxx_make_type (DECLTYPE_TYPE); DECLTYPE_TYPE_EXPR (type) = expr; DECLTYPE_FOR_LAMBDA_CAPTURE (type) = true; DECLTYPE_FOR_INIT_CAPTURE (type) = explicit_init_p; SET_TYPE_STRUCTURAL_EQUALITY (type); } return type; }