Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/class_decl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21533,11 +21533,12 @@ be entered.
/* Copy the type (which may have been changed by apply_bit_field_size) into
the field entry. */
field->type = member_type;
/* For an unnamed bit field, do not create the field symbol. */
/* For an unnamed bit field, create an unnamed field symbol that is not
entered in the symbol table. */
if (unnamed_field && decl_info->is_bit_field) {
/* All field entries for an unnamed bit field share the same symbol. It is
used for easy identification. */
field->source_corresp.assoc_info = (char *)get_unnamed_field_symbol();
member_sym = make_unnamed_field_symbol(&locator->source_position);
member_sym->variant.field.ptr = field;
field->source_corresp.assoc_info = (char *)member_sym;
/* Update the source correspondence information manually -- there's no
symbol. */
field->source_corresp.decl_position = locator->source_position;
Expand Down Expand Up @@ -21633,7 +21634,9 @@ be entered.
/* Fields of closure types may be declared "on the fly" (in the case of
implicit captures), and are not subject to pragmas in any case.
However, we do want to record the declaration of init-capture fields. */
} else if (member_sym != NULL && !decl_info->is_anonymous_union) {
} else if (member_sym != NULL && !decl_info->is_anonymous_union &&
!is_unnamed_field_symbol(member_sym)) {
/* (The declaration of an unnamed bit-field was recorded above.) */
record_symbol_declaration(SRK_DECLARATION | SRK_DEFINITION, member_sym,
&locator->source_position,
decl_state->source_sequence_entry);
Expand Down
2 changes: 1 addition & 1 deletion src/decl_inits.c
Original file line number Diff line number Diff line change
Expand Up @@ -9201,7 +9201,7 @@ non-NULL, set *end_of_list to the last initializer in the list.
} /* if */
} else if (!field->compiler_generated) {
a_symbol_ptr sym = symbol_for(field);
if (sym == NULL || sym->is_error || sym == get_unnamed_field_symbol()) {
if (sym == NULL || sym->is_error || is_unnamed_field_symbol(sym)) {
/* Skip over any error and unnamed fields. */
continue;
} /* if */
Expand Down
1 change: 1 addition & 0 deletions src/decl_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -7207,6 +7207,7 @@ template. dsi_flags is the set of input flags passed to decl_specifiers.
} else if (is_definition) {
/* An unnamed enum type. mark_defined can't be called to record the
declaration, so the subroutines that do so are called directly. */
set_decl_sequence_number(tag_sym);
#if MAINTAIN_CLASS_MEMBER_LIST
record_class_member_declaration((char*)enum_type, iek_type);
#endif /* MAINTAIN_CLASS_MEMBER_LIST */
Expand Down
3 changes: 2 additions & 1 deletion src/decls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2834,10 +2834,11 @@ is invalid. Also promote the fields of the union type to the current scope.
/* Promote the fields of the anonymous union to the current scope, and do
some error checking on the anonymous union's members. */
assoc_object_sym = make_anonymous_parent_object_symbol(
(a_symbol_kind)sk_variable,
sk_variable,
&pos_curr_token,
scope_stack[decl_scope_level].number);
assoc_object_sym->variant.variable.ptr = vp;
vp->source_corresp.assoc_info = (char*)assoc_object_sym;
if (at_file_or_namespace_scope) {
set_namespace_membership(assoc_object_sym, &vp->source_corresp,
(a_namespace_ptr)NULL);
Expand Down
23 changes: 14 additions & 9 deletions src/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -10841,6 +10841,7 @@ a left parenthesis in the source.
{
locator->source_position = eriep->saved_operand.position;
} /* if */
locator->is_splicer = eriep->saved_operand.designated_by_splice;
/* For a qualified id case, make sure the id is a member of the class
or one of its base classes. */
if (need_member_sym_check && !*err && is_qualified) {
Expand Down Expand Up @@ -11553,7 +11554,8 @@ case).
operand_1, is_arrow_operator, member_sym,
projection_member_sym,
(a_boolean)locator.access_control_error_reported,
/*do_protected_member_check=*/TRUE, &member_position);
/*do_protected_member_check=*/!locator.is_splicer,
&member_position);
do_field_selection_operation(operand_1, orig_class_struct_union_type,
is_arrow_operator,
/*compiler_generated=*/FALSE,
Expand Down Expand Up @@ -11629,7 +11631,7 @@ case).
error_and_make_error_operand(ec_expr_not_constant, result);
} else {
if (!force_indefinite_function &&
member_sym->kind == (a_symbol_kind)sk_member_function) {
symbol_is(member_sym, sk_member_function)) {
/* For a simple non-overloaded function, adjust the selector
to the proper class. We don't do this for the
cases that go through overload resolution, since that
Expand All @@ -11639,15 +11641,16 @@ case).
is_arrow_operator,
member_sym,
projection_member_sym,
(a_boolean)locator.
access_control_error_reported,
/*do_protected_member_check=*/TRUE,
(a_boolean)locator
.access_control_error_reported,
/*do_protected_member_check=*/
!locator.is_splicer,
&member_position);
} /* if */
/* Make an operand for the function with the selector bound
to it. */
if (member_sym->kind == (a_symbol_kind)sk_overloaded_function ||
member_sym->kind == (a_symbol_kind)sk_function_template ||
if (symbol_is(member_sym, sk_overloaded_function) ||
symbol_is(member_sym, sk_function_template) ||
force_indefinite_function) {
/* Overloaded function or member template. */
make_indefinite_function_operand(projection_member_sym,
Expand All @@ -11672,7 +11675,7 @@ case).
&end_position),
rep,
result);
set_operand_name_reference_from_locator(result, &locator);
set_operand_id_details_from_locator(result, &locator);
} /* if */
copy_operand(operand_1, bound_function_selector) /*lint !e413*/;
bind_member_function_operand_to_selector(bound_function_selector,
Expand All @@ -11690,7 +11693,7 @@ case).
&end_position),
rep,
result);
set_operand_name_reference_from_locator(result, &locator);
set_operand_id_details_from_locator(result, &locator);
treat_as_static_member:
result->is_name_followed_by_left_paren =
member_name_followed_by_left_paren;
Expand Down Expand Up @@ -41914,6 +41917,7 @@ FIXME: This is currently incomplete.
(a_ref_entry*)NULL,
result);
result->is_id_expression = TRUE;
result->designated_by_splice = TRUE;
} else if (iek == iek_variable) {
vp = (a_variable*)rvp->entity.ptr;
variable_case:
Expand All @@ -41936,6 +41940,7 @@ FIXME: This is currently incomplete.
(a_ref_entry*)NULL,
result);
result->is_id_expression = TRUE;
result->designated_by_splice = TRUE;
} else {
make_function_designator_operand(symbol_for(rp),
/*is_qualified_name=*/FALSE,
Expand Down
17 changes: 12 additions & 5 deletions src/exprutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -3489,6 +3489,7 @@ values.
operand->is_qualified_name = FALSE;
operand->is_microsoft_deferred_name = FALSE;
operand->access_control_error_reported = FALSE;
operand->designated_by_splice = FALSE;
operand->is_operand_of_address_of = FALSE;
operand->has_required_ptr_to_member_form = FALSE;
operand->is_template_id = FALSE;
Expand Down Expand Up @@ -6344,10 +6345,11 @@ This includes in particular name reference information.
{
set_operand_name_reference_from_locator(operand, locator);
operand->is_qualified_name = locator->is_qualified_name;
if (operand->kind == (an_operand_kind)ok_indefinite_function ||
operand->kind == (an_operand_kind)ok_undefined_symbol
operand->designated_by_splice = locator->is_splicer;
if (is_indefinite_function_operand(operand) ||
is_undefined_symbol_operand(operand)
#if MICROSOFT_EXTENSIONS_ALLOWED
|| operand->kind == (an_operand_kind)ok_property_ref
|| is_property_ref_operand(operand)
#endif /* MICROSOFT_EXTENSIONS_ALLOWED */
) {
operand->id_position = locator->source_position;
Expand Down Expand Up @@ -7422,6 +7424,7 @@ destroyed its source position, etc. Restore such things from
orig_operand->selector_is_object_pointer;
operand->virtual_function = orig_operand->virtual_function;
operand->is_qualified_name = orig_operand->is_qualified_name;
operand->designated_by_splice = orig_operand->designated_by_splice;
operand->access_control_error_reported =
orig_operand->access_control_error_reported;
operand->is_operand_of_address_of =
Expand Down Expand Up @@ -23641,7 +23644,7 @@ by an "&" in the source, and *ampersand_position gives its position.
{
an_operand orig_operand;
a_symbol_ptr member_sym, fund_sym;
a_boolean has_required_ampersand;
a_boolean has_required_ampersand, check_protected_access;
a_boolean allow_addr_of_managed_member = FALSE, force_node = FALSE;

has_required_ampersand = (ampersand_position != NULL &&
Expand Down Expand Up @@ -23669,11 +23672,15 @@ by an "&" in the source, and *ampersand_position gives its position.
#if MICROSOFT_EXTENSIONS_ALLOWED
allow_addr_of_managed_member = operand->allow_addr_of_managed_member;
#endif /* MICROSOFT_EXTENSIONS_ALLOWED */
/* The protected member access check does not apply to a member designated
by a splice-expression (N5046 [class.protected]). */
check_protected_access = !operand->access_control_error_reported &&
!operand->designated_by_splice;
/* Make an operand for a pointer-to-member constant. */
make_ptr_to_member_constant_operand(member_sym, member_sym,
&orig_operand.position,
end_position_of_operand(&orig_operand),
!operand->access_control_error_reported,
check_protected_access,
(a_boolean)operand->is_qualified_name,
has_required_ampersand,
allow_addr_of_managed_member,
Expand Down
9 changes: 9 additions & 0 deletions src/exprutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,15 @@ typedef struct an_operand {
essentially still just a representation for
an identifier, e.g., ok_indefinite_function and
ok_sym_for_member. */
a_bit_field designated_by_splice:1;
/* TRUE if this operand was generated from a
splice-expression designating a class member.
Such a member is accessible from any point, and
the additional protected member access check
(N5046 [class.protected]) does not apply to it.
Like access_control_error_reported, this
remains meaningful only for ok_sym_for_member
operands. */
a_bit_field is_operand_of_address_of:1;
/* TRUE if this operand is the immediate operand
of an "&" address-of operator. This is
Expand Down
3 changes: 2 additions & 1 deletion src/folding.c
Original file line number Diff line number Diff line change
Expand Up @@ -9058,7 +9058,8 @@ architectures for which these assumptions are not valid.
} else if (!type_is(type, tk_union) &&
field->is_bit_field && field->bit_size != 0 &&
unnamed_bit_field_is_padding() &&
symbol_for(field) == get_unnamed_field_symbol()) {
symbol_for(field) != NULL &&
is_unnamed_field_symbol(symbol_for(field))) {
/* An unnamed bit-field of non-zero width is padding. (In a
union, an unnamed bit-field overlaps the other members, so
it is handled by the size test above instead.) */
Expand Down
Loading
Loading