FreeBSD/contrib/gcc/cp/decl.c
/* Subroutine of reshape_init_r, processes the initializers for classes
   or union. Parameters are the same of reshape_init_r.  */
Subroutine of reshape_init_r, processes the initializers for classes
or union. Parameters are the same of reshape_init_r.
Subroutine of reshape_init_r processes the initializers for classes or union . Parameters are the same of reshape_init_r .
static tree
reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p)
{
  tree field;
  tree new_init;
  gcc_assert (CLASS_TYPE_P (type));
  new_init = build_constructor (NULL_TREE, NULL);
  field = next_initializable_field (TYPE_FIELDS (type));
  if (!field)
    {
      if (!first_initializer_p)
	{
	  error ("initializer for %qT must be brace-enclosed", type);
	  return error_mark_node;
	}
      return new_init;
    }
  while (d->cur != d->end)
    {
      tree field_init;
      if (d->cur->index)
	{
	  field = lookup_field_1 (type, d->cur->index, false);
	  if (!field || TREE_CODE (field) != FIELD_DECL)
	    {
	      error ("%qT has no non-static data member named %qD", type,
		    d->cur->index);
	      return error_mark_node;
	    }
	}
      if (!field)
	break;
      field_init = reshape_init_r (TREE_TYPE (field), d,
				   false);
      CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_init), field, field_init);
      if (TREE_CODE (type) == UNION_TYPE)
	break;
      field = next_initializable_field (TREE_CHAIN (field));
    }
  return new_init;
}
static tree reshape_init_class ( tree type , reshape_iter * d , bool first_initializer_p ) { tree field ; tree new_init ; gcc_assert ( CLASS_TYPE_P ( type ) ) ; new_init = build_constructor ( NULL_TREE , NULL ) ; field = next_initializable_field ( TYPE_FIELDS ( type ) ) ; if ( ! field ) { if ( ! first_initializer_p ) { error ( " " , type ) ; return error_mark_node ; } return new_init ; } while ( d -> cur != d -> end ) { tree field_init ; if ( d -> cur -> index ) { field = lookup_field_1 ( type , d -> cur -> index , false ) ; if ( ! field || TREE_CODE ( field ) != FIELD_DECL ) { error ( " " , type , d -> cur -> index ) ; return error_mark_node ; } } if ( ! field ) break ; field_init = reshape_init_r ( TREE_TYPE ( field ) , d , false ) ; CONSTRUCTOR_APPEND_ELT ( CONSTRUCTOR_ELTS ( new_init ) , field , field_init ) ; if ( TREE_CODE ( type ) == UNION_TYPE ) break ; field = next_initializable_field ( TREE_CHAIN ( field ) ) ; } return new_init ; }
Subroutine of reshape_init_r, processes the initializers for classes
or union.
Subroutine of reshape_init_r processes the initializers for classes or union .
/* The initializer for a class is always a CONSTRUCTOR.  */ /* [dcl.init.aggr]

	An initializer for an aggregate member that is an
	empty class shall have the form of an empty
	initializer-list {}.  */ /* Loop through the initializable fields, gathering initializers.  */ /* Handle designated initializers, as an extension.  */ /*want_type=*/ /* If we processed all the member of the class, we are done.  */ /*first_initializer_p=*/ /* [dcl.init.aggr]

	When a union  is  initialized with a brace-enclosed
	initializer, the braces shall only contain an
	initializer for the first member of the union.  */