init.c (build_new_1): Split out from build_new.
[gcc.git] / gcc / cp / call.c
index 827e904022742aa59d5286d57894313fcf801178..848a821ee953511b26c24f9ab56c29ca25a0abb0 100644 (file)
@@ -3318,7 +3318,8 @@ implicit_conversion (to, from, expr, flags)
 
   if (conv)
     ;
-  else if ((IS_AGGR_TYPE (non_reference (from))
+  else if (expr != NULL_TREE
+          && (IS_AGGR_TYPE (non_reference (from))
            || IS_AGGR_TYPE (non_reference (to)))
           && (flags & LOOKUP_NO_CONVERSION) == 0)
     {
@@ -3604,6 +3605,9 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
     case POSTDECREMENT_EXPR:
       args[1] = integer_zero_node;
       type2 = integer_type_node;
+      break;
+    default:
+      break;
     }
 
   switch (code)
@@ -4734,7 +4738,6 @@ build_new_op (code, flags, arg1, arg2, arg3)
          return rval;
 
        TREE_TYPE (rval) = arg1;
-       TREE_CALLS_NEW (rval) = 1;
        return rval;
       }
 
@@ -4784,6 +4787,9 @@ build_new_op (code, flags, arg1, arg2, arg3)
 
     case CALL_EXPR:
       return build_object_call (arg1, arg2);
+
+    default:
+      break;
     }
 
   /* The comma operator can have void args.  */
@@ -4919,6 +4925,9 @@ build_new_op (code, flags, arg1, arg2, arg3)
        case COMPOUND_EXPR:
        case COMPONENT_REF:
          return NULL_TREE;
+
+       default:
+         break;
        }
       if (flags & LOOKUP_COMPLAIN)
        {
@@ -4993,6 +5002,9 @@ build_new_op (code, flags, arg1, arg2, arg3)
          cp_warning ("comparison between `%#T' and `%#T'", 
                      TREE_TYPE (arg1), TREE_TYPE (arg2));
        }
+      break;
+    default:
+      break;
     }
 
   /* We need to strip any leading REF_BIND so that bitfields don't cause
@@ -5305,6 +5317,9 @@ convert_like (convs, expr)
       /* Call build_user_type_conversion again for the error.  */
       return build_user_type_conversion
        (TREE_TYPE (convs), TREE_OPERAND (convs, 0), LOOKUP_NORMAL);
+
+    default:
+      break;
     };
 
   expr = convert_like (TREE_OPERAND (convs, 0), expr);
@@ -5327,6 +5342,9 @@ convert_like (convs, expr)
         error_mark_node);
     case LVALUE_CONV:
       return decay_conversion (expr);
+
+    default:
+      break;
     }
   return ocp_convert (TREE_TYPE (convs), expr, CONV_IMPLICIT,
                      LOOKUP_NORMAL|LOOKUP_NO_CONVERSION);
@@ -5502,7 +5520,10 @@ build_over_call (fn, convs, args, flags)
       && copy_args_p (fn))
     {
       tree targ;
-      arg = TREE_VALUE (TREE_CHAIN (converted_args));
+      arg = TREE_CHAIN (converted_args);
+      if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
+       arg = TREE_CHAIN (arg);
+      arg = TREE_VALUE (arg);
 
       /* Pull out the real argument, disregarding const-correctness.  */
       targ = arg;