commit 520217cc15315fe1cc58dff23c65bb3cdc28dc56 Author: Jason Merrill Date: Wed Nov 29 21:51:36 2023 -0500 wildcard diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 7946f0be77b..e0cb8a1b04f 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -2265,6 +2265,10 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope, else if (PACK_EXPANSION_P (type)) /* Don't bother trying to represent this. */ type = NULL_TREE; + else if (WILDCARD_TYPE_P (TREE_TYPE (object))) + /* We don't know what the eventual quals will be. This can happen when + called from build_capture_proxy for an explicit object lambda. */ + type = NULL_TREE; else { /* Set the cv qualifiers. */ @@ -11709,6 +11713,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, A::U doesn't require 'typename'. */ if (instantiation_dependent_uneval_expression_p (expr)) { + dependent: type = cxx_make_type (DECLTYPE_TYPE); DECLTYPE_TYPE_EXPR (type) = expr; DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (type) @@ -11883,7 +11888,11 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, if (outer_automatic_var_p (STRIP_REFERENCE_REF (expr)) && current_function_decl && LAMBDA_FUNCTION_P (current_function_decl)) - type = capture_decltype (STRIP_REFERENCE_REF (expr)); + { + type = capture_decltype (STRIP_REFERENCE_REF (expr)); + if (!type) + goto dependent; + } else if (error_operand_p (expr)) type = error_mark_node; else if (expr == current_class_ptr) @@ -12821,7 +12830,8 @@ capture_decltype (tree decl) { int quals = cp_type_quals (type); tree obtype = TREE_TYPE (DECL_ARGUMENTS (current_function_decl)); - gcc_checking_assert (!WILDCARD_TYPE_P (non_reference (obtype))); + if (WILDCARD_TYPE_P (non_reference (obtype))) + return NULL_TREE; if (INDIRECT_TYPE_P (obtype)) quals |= cp_type_quals (TREE_TYPE (obtype)); type = cp_build_qualified_type (type, quals);