FreeBSD/contrib/gcc/cp/decl.c
/* Returns an ARRAY_TYPE for an array with SIZE elements of the
   indicated TYPE.  If non-NULL, NAME is the NAME of the declaration
   with this type.  */
Returns an ARRAY_TYPE for an array with SIZE elements of the
indicated TYPE.  If non-NULL, NAME is the NAME of the declaration
with this type.
Returns an ARRAY_TYPE for an array with SIZE elements of the indicated TYPE . If non - NULL NAME is the NAME of the declaration with this type .
static tree
create_array_type_for_decl (tree name, tree type, tree size)
{
  tree itype = NULL_TREE;
  const char* error_msg;
  if (type == error_mark_node || size == error_mark_node)
    return error_mark_node;
  error_msg = NULL;
  switch (TREE_CODE (type))
    {
    case VOID_TYPE:
      error_msg = "array of void";
      break;
    case FUNCTION_TYPE:
      error_msg = "array of functions";
      break;
    case REFERENCE_TYPE:
      error_msg = "array of references";
      break;
    case METHOD_TYPE:
      error_msg = "array of function members";
      break;
    default:
      break;
    }
  if (error_msg)
    {
      if (name)
	error ("declaration of %qD as %s", name, error_msg);
      else
	error ("creating %s", error_msg);
      return error_mark_node;
    }
  if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type))
    {
      if (name)
	error ("declaration of %qD as multidimensional array must "
	       "have bounds for all dimensions except the first",
	       name);
      else
	error ("multidimensional array must have bounds for all "
	       "dimensions except the first");
      return error_mark_node;
    }
  if (size)
    itype = compute_array_index_type (name, size);
  abstract_virtuals_error (name, type);
  return build_cplus_array_type (type, itype);
}
static tree create_array_type_for_decl ( tree name , tree type , tree size ) { tree itype = NULL_TREE ; const char * error_msg ; if ( type == error_mark_node || size == error_mark_node ) return error_mark_node ; error_msg = NULL ; switch ( TREE_CODE ( type ) ) { case VOID_TYPE : error_msg = " " ; break ; case FUNCTION_TYPE : error_msg = " " ; break ; case REFERENCE_TYPE : error_msg = " " ; break ; case METHOD_TYPE : error_msg = " " ; break ; default : break ; } if ( error_msg ) { if ( name ) error ( " " , name , error_msg ) ; else error ( " " , error_msg ) ; return error_mark_node ; } if ( TREE_CODE ( type ) == ARRAY_TYPE && ! TYPE_DOMAIN ( type ) ) { if ( name ) error ( " " " " , name ) ; else error ( " " " " ) ; return error_mark_node ; } if ( size ) itype = compute_array_index_type ( name , size ) ; abstract_virtuals_error ( name , type ) ; return build_cplus_array_type ( type , itype ) ; }
Returns an ARRAY_TYPE for an array with SIZE elements of the
indicated TYPE.
Returns an ARRAY_TYPE for an array with SIZE elements of the indicated TYPE .
/* If things have already gone awry, bail now.  */ /* Assume that everything will go OK.  */ /* There are some types which cannot be array elements.  */ /* If something went wrong, issue an error-message and return.  */ /* [dcl.array]

     The constant expressions that specify the bounds of the arrays
     can be omitted only for the first member of the sequence.  */ /* Figure out the index type for the array.  */ /* [dcl.array]
     T is called the array element type; this type shall not be [...] an
     abstract class type.  */