[C++ Patch] PR 66644

Jason Merrill jason@redhat.com
Fri Apr 29 13:58:00 GMT 2016


On 04/28/2016 08:18 PM, Paolo Carlini wrote:
>     else if (ANON_AGGR_TYPE_P (type))
>       {
> -      tree fields;
> -
> -      for (fields = TYPE_FIELDS (type); fields; fields = DECL_CHAIN (fields))
> +      for (tree fields = TYPE_FIELDS (type); fields;
> +	   fields = DECL_CHAIN (fields))
>   	if (TREE_CODE (fields) == FIELD_DECL && !DECL_C_BIT_FIELD (field))
> -	  check_field_decl (fields, t, cant_have_const_ctor,
> -			    no_const_asn_ref, any_default_members);
> +	  any_default_members_field |= check_field_decl (fields, t,
> +							 cant_have_const_ctor,
> +							 no_const_asn_ref,
> +							 any_default_members);

The logic here seems convoluted.  I guess we don't need to handle 
anonymous structs and unions differently here because we'll call 
check_field_decls for the anonymous union itself, and complain then?  In 
that case, instead of passing down any_default_members at all, can we 
just pass it up and complain in check_field_decls?

Jason



More information about the Gcc-patches mailing list