OSDN Git Service

1999-11-25 Mark Mitchell <mark@codesourcery.com>
[pf3gnuchains/gcc-fork.git] / gcc / cp / cvt.c
index 382a9b2..d07c1d2 100644 (file)
@@ -357,16 +357,11 @@ build_up_reference (type, arg, flags)
 
       /* Process the initializer for the declaration.  */
       DECL_INITIAL (arg) = targ;
-      cp_finish_decl (arg, targ, NULL_TREE, 0,
+      cp_finish_decl (arg, targ, NULL_TREE, 
                      LOOKUP_ONLYCONVERTING|DIRECT_BIND);
     }
   else if (!(flags & DIRECT_BIND) && ! lvalue_p (arg))
-    {
-      tree slot = build_decl (VAR_DECL, NULL_TREE, argtype);
-      DECL_ARTIFICIAL (slot) = 1;
-      arg = build (TARGET_EXPR, argtype, slot, arg, NULL_TREE, NULL_TREE);
-      TREE_SIDE_EFFECTS (arg) = 1;
-    }
+    return get_target_expr (arg);
 
   /* If we had a way to wrap this up, and say, if we ever needed it's
      address, transform all occurrences of the register, into a memory
@@ -675,6 +670,9 @@ ocp_convert (type, expr, convtype, flags)
       || TREE_TYPE (e) == error_mark_node)
     return error_mark_node;
 
+  complete_type (type);
+  complete_type (TREE_TYPE (expr));
+
   if (TREE_READONLY_DECL_P (e))
     e = decl_constant_value (e);
 
@@ -742,10 +740,17 @@ ocp_convert (type, expr, convtype, flags)
        }
       if (code == BOOLEAN_TYPE)
        {
+         tree fn = NULL_TREE;
+
          /* Common Ada/Pascal programmer's mistake.  We always warn
              about this since it is so bad.  */
          if (TREE_CODE (expr) == FUNCTION_DECL)
-           cp_warning ("the address of `%D', will always be `true'", expr);
+           fn = expr;
+         else if (TREE_CODE (expr) == ADDR_EXPR 
+                  && TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL)
+           fn = TREE_OPERAND (expr, 0);
+         if (fn)
+           cp_warning ("the address of `%D', will always be `true'", fn);
          return truthvalue_conversion (e);
        }
       return fold (convert_to_integer (type, e));