This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 66644


Hi,

On 29/04/2016 15:58, Jason Merrill wrote:
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?
Indeed. Code reworked along these lines becomes even comprehensible ;) Something as simple as the below passes testing....

Thanks,
Paolo.

////////////////////////////

Attachment: patch_66644_3
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]