FreeBSD/contrib/gcc/cp/decl.c
/* Handle initialization of references.  DECL, TYPE, and INIT have the
   same meaning as in cp_finish_decl.  *CLEANUP must be NULL on entry,
   but will be set to a new CLEANUP_STMT if a temporary is created
   that must be destroyed subsequently.

   Returns an initializer expression to use to initialize DECL, or
   NULL if the initialization can be performed statically.

   Quotes on semantics can be found in ARM 8.4.3.  */
Handle initialization of references.  DECL, TYPE, and INIT have the
same meaning as in cp_finish_decl.  *CLEANUP must be NULL on entry,
but will be set to a new CLEANUP_STMT if a temporary is created
that must be destroyed subsequently.

Returns an initializer expression to use to initialize DECL, or
NULL if the initialization can be performed statically.

Quotes on semantics can be found in ARM 8.4.3.
Handle initialization of references . DECL TYPE and INIT have the same meaning as in cp_finish_decl . * CLEANUP must be NULL on entry but will be set to a new CLEANUP_STMT if a temporary is created that must be destroyed subsequently . Returns an initializer expression to use to initialize DECL or NULL if the initialization can be performed statically . Quotes on semantics can be found in ARM 8 . 4 . 3 .
static tree
grok_reference_init (tree decl, tree type, tree init, tree *cleanup)
{
  tree tmp;
  if (init == NULL_TREE)
    {
      if ((DECL_LANG_SPECIFIC (decl) == 0
	   || DECL_IN_AGGR_P (decl) == 0)
	  && ! DECL_THIS_EXTERN (decl))
	error ("%qD declared as reference but not initialized", decl);
      return NULL_TREE;
    }
  if (TREE_CODE (init) == CONSTRUCTOR)
    {
      error ("ISO C++ forbids use of initializer list to "
	     "initialize reference %qD", decl);
      return NULL_TREE;
    }
  if (TREE_CODE (init) == TREE_LIST)
    init = build_x_compound_expr_from_list (init, "initializer");
  if (TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE
      && TREE_CODE (TREE_TYPE (init)) == ARRAY_TYPE)
    init = decay_conversion (init);
  tmp = initialize_reference (type, init, decl, cleanup);
  if (tmp == error_mark_node)
    return NULL_TREE;
  else if (tmp == NULL_TREE)
    {
      error ("cannot initialize %qT from %qT", type, TREE_TYPE (init));
      return NULL_TREE;
    }
  if (TREE_STATIC (decl) && !TREE_CONSTANT (tmp))
    return tmp;
  DECL_INITIAL (decl) = tmp;
  return NULL_TREE;
}
static tree grok_reference_init ( tree decl , tree type , tree init , tree * cleanup ) { tree tmp ; if ( init == NULL_TREE ) { if ( ( DECL_LANG_SPECIFIC ( decl ) == 0 || DECL_IN_AGGR_P ( decl ) == 0 ) && ! DECL_THIS_EXTERN ( decl ) ) error ( " " , decl ) ; return NULL_TREE ; } if ( TREE_CODE ( init ) == CONSTRUCTOR ) { error ( " " " " , decl ) ; return NULL_TREE ; } if ( TREE_CODE ( init ) == TREE_LIST ) init = build_x_compound_expr_from_list ( init , " " ) ; if ( TREE_CODE ( TREE_TYPE ( type ) ) != ARRAY_TYPE && TREE_CODE ( TREE_TYPE ( init ) ) == ARRAY_TYPE ) init = decay_conversion ( init ) ; tmp = initialize_reference ( type , init , decl , cleanup ) ; if ( tmp == error_mark_node ) return NULL_TREE ; else if ( tmp == NULL_TREE ) { error ( " " , type , TREE_TYPE ( init ) ) ; return NULL_TREE ; } if ( TREE_STATIC ( decl ) && ! TREE_CONSTANT ( tmp ) ) return tmp ; DECL_INITIAL ( decl ) = tmp ; return NULL_TREE ; }
Handle initialization of references.
Handle initialization of references .
/* Note: default conversion is only called in very special cases.  */ /* Convert INIT to the reference type TYPE.  This may involve the
     creation of a temporary, whose lifetime must be the same as that
     of the reference.  If so, a DECL_EXPR for the temporary will be
     added just after the DECL_EXPR for DECL.  That's why we don't set
     DECL_INITIAL for local references (instead assigning to them
     explicitly); we need to allow the temporary to be initialized
     first.  */