OSDN Git Service

(build_c_cast): Bypass default_conversion when casting to void.
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Feb 1993 23:00:46 +0000 (23:00 +0000)
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Feb 1993 23:00:46 +0000 (23:00 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@3423 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-typeck.c

index 3cb6959..7bbad14 100644 (file)
@@ -3756,6 +3756,12 @@ build_c_cast (type, expr)
   else
     {
       tree otype;
+
+      /* If casting to void, avoid the error that would come
+        from default_conversion in the case of a non-lvalue array.  */
+      if (type == void_type_node)
+       return build1 (CONVERT_EXPR, type, value);
+
       /* Convert functions and arrays to pointers,
         but don't convert any other types.  */
       if (TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE