OSDN Git Service

* gcc.dg/tree-ssa/fre-vce-1.c: Cleanup "fre" tree dump.
[pf3gnuchains/gcc-fork.git] / gcc / cp / class.c
index 1a96384..d86ff64 100644 (file)
@@ -295,7 +295,7 @@ build_base_path (enum tree_code code,
 
   /* Don't bother with the calculations inside sizeof; they'll ICE if the
      source type is incomplete and the pointer value doesn't matter.  */
-  if (skip_evaluation)
+  if (cp_unevaluated_operand != 0)
     {
       expr = build_nop (build_pointer_type (target_type), expr);
       if (!want_pointer)
@@ -625,9 +625,8 @@ build_vtbl_ref_1 (tree instance, tree idx)
   if (!vtbl)
     vtbl = build_vfield_ref (instance, basetype);
 
-  assemble_external (vtbl);
 
-  aref = build_array_ref (vtbl, idx, input_location);
+  aref = build_array_ref (input_location, vtbl, idx);
   TREE_CONSTANT (aref) |= TREE_CONSTANT (vtbl) && TREE_CONSTANT (idx);
 
   return aref;
@@ -775,7 +774,7 @@ get_vtable_decl (tree type, int complete)
   if (complete)
     {
       DECL_EXTERNAL (decl) = 1;
-      finish_decl (decl, NULL_TREE, NULL_TREE);
+      cp_finish_decl (decl, NULL_TREE, false, NULL_TREE, 0);
     }
 
   return decl;
@@ -2706,7 +2705,7 @@ check_bitfield_decl (tree field)
   DECL_INITIAL (field) = NULL_TREE;
 
   /* Detect invalid bit-field type.  */
-  if (!INTEGRAL_TYPE_P (type))
+  if (!INTEGRAL_OR_ENUMERATION_TYPE_P (type))
     {
       error ("bit-field %q+#D with non-integral type", field);
       w = error_mark_node;
@@ -3637,7 +3636,8 @@ build_base_field (record_layout_info rli, tree binfo,
       CLASSTYPE_EMPTY_P (t) = 0;
 
       /* Create the FIELD_DECL.  */
-      decl = build_decl (FIELD_DECL, NULL_TREE, CLASSTYPE_AS_BASE (basetype));
+      decl = build_decl (input_location,
+                        FIELD_DECL, NULL_TREE, CLASSTYPE_AS_BASE (basetype));
       DECL_ARTIFICIAL (decl) = 1;
       DECL_IGNORED_P (decl) = 1;
       DECL_FIELD_CONTEXT (decl) = t;
@@ -4429,7 +4429,8 @@ create_vtable_ptr (tree t, tree* virtuals_p)
         stores cannot alias stores to void*!  */
       tree field;
 
-      field = build_decl (FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node);
+      field = build_decl (input_location, 
+                         FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node);
       DECL_VIRTUAL_P (field) = 1;
       DECL_ARTIFICIAL (field) = 1;
       DECL_FIELD_CONTEXT (field) = t;
@@ -4865,7 +4866,7 @@ layout_class_type (tree t, tree *virtuals_p)
       if (DECL_C_BIT_FIELD (field)
          && INT_CST_LT (TYPE_SIZE (type), DECL_SIZE (field)))
        {
-         integer_type_kind itk;
+         unsigned int itk;
          tree integer_type;
          bool was_unnamed_p = false;
          /* We must allocate the bits as if suitably aligned for the
@@ -5009,7 +5010,8 @@ layout_class_type (tree t, tree *virtuals_p)
        {
          tree padding_field;
 
-         padding_field = build_decl (FIELD_DECL,
+         padding_field = build_decl (input_location,
+                                     FIELD_DECL,
                                      NULL_TREE,
                                      char_type_node);
          DECL_BIT_FIELD (padding_field) = 1;
@@ -5097,7 +5099,8 @@ layout_class_type (tree t, tree *virtuals_p)
       for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
        if (TREE_CODE (field) == FIELD_DECL)
          {
-           *next_field = build_decl (FIELD_DECL,
+           *next_field = build_decl (input_location,
+                                     FIELD_DECL,
                                      DECL_NAME (field),
                                      TREE_TYPE (field));
            DECL_CONTEXT (*next_field) = base_t;
@@ -5138,7 +5141,8 @@ layout_class_type (tree t, tree *virtuals_p)
   /* Make sure not to create any structures with zero size.  */
   if (integer_zerop (rli_size_unit_so_far (rli)) && CLASSTYPE_EMPTY_P (t))
     place_field (rli,
-                build_decl (FIELD_DECL, NULL_TREE, char_type_node));
+                build_decl (input_location,
+                            FIELD_DECL, NULL_TREE, char_type_node));
 
   /* Let the back end lay out the type.  */
   finish_record_layout (rli, /*free_p=*/true);
@@ -6073,6 +6077,9 @@ resolve_address_of_overloaded_function (tree target_type,
       tree target_arg_types;
       tree target_ret_type;
       tree fns;
+      tree *args;
+      unsigned int nargs, ia;
+      tree arg;
 
       if (is_ptrmem)
        target_fn_type
@@ -6086,6 +6093,14 @@ resolve_address_of_overloaded_function (tree target_type,
       if (TREE_CODE (target_fn_type) == METHOD_TYPE)
        target_arg_types = TREE_CHAIN (target_arg_types);
 
+      nargs = list_length (target_arg_types);
+      args = XALLOCAVEC (tree, nargs);
+      for (arg = target_arg_types, ia = 0;
+          arg != NULL_TREE && arg != void_list_node;
+          arg = TREE_CHAIN (arg), ++ia)
+       args[ia] = TREE_VALUE (arg);
+      nargs = ia;
+
       for (fns = overload; fns; fns = OVL_NEXT (fns))
        {
          tree fn = OVL_CURRENT (fns);
@@ -6105,9 +6120,9 @@ resolve_address_of_overloaded_function (tree target_type,
 
          /* Try to do argument deduction.  */
          targs = make_tree_vec (DECL_NTPARMS (fn));
-         if (fn_type_unification (fn, explicit_targs, targs,
-                                  target_arg_types, target_ret_type,
-                                  DEDUCE_EXACT, LOOKUP_NORMAL))
+         if (fn_type_unification (fn, explicit_targs, targs, args, nargs,
+                                  target_ret_type, DEDUCE_EXACT,
+                                  LOOKUP_NORMAL))
            /* Argument deduction failed.  */
            continue;
 
@@ -6148,7 +6163,7 @@ resolve_address_of_overloaded_function (tree target_type,
       if (flags & tf_error)
        {
          error ("no matches converting function %qD to type %q#T",
-                DECL_NAME (OVL_FUNCTION (overload)),
+                DECL_NAME (OVL_CURRENT (overload)),
                 target_type);
 
          /* print_candidates expects a chain with the functions in
@@ -6311,13 +6326,8 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
      dependent on overload resolution.  */
   gcc_assert (TREE_CODE (rhs) == ADDR_EXPR
              || TREE_CODE (rhs) == COMPONENT_REF
-             || TREE_CODE (rhs) == COMPOUND_EXPR
-             || really_overloaded_fn (rhs));
-
-  /* We don't overwrite rhs if it is an overloaded function.
-     Copying it would destroy the tree link.  */
-  if (TREE_CODE (rhs) != OVERLOAD)
-    rhs = copy_node (rhs);
+             || really_overloaded_fn (rhs)
+             || (flag_ms_extensions && TREE_CODE (rhs) == FUNCTION_DECL));
 
   /* This should really only be used when attempting to distinguish
      what sort of a pointer to function we have.  For now, any
@@ -6369,19 +6379,6 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
                                                /*explicit_targs=*/NULL_TREE,
                                                access_path);
 
-    case COMPOUND_EXPR:
-      TREE_OPERAND (rhs, 0)
-       = instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
-      if (TREE_OPERAND (rhs, 0) == error_mark_node)
-       return error_mark_node;
-      TREE_OPERAND (rhs, 1)
-       = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
-      if (TREE_OPERAND (rhs, 1) == error_mark_node)
-       return error_mark_node;
-
-      TREE_TYPE (rhs) = lhstype;
-      return rhs;
-
     case ADDR_EXPR:
     {
       if (PTRMEM_OK_P (rhs))