(build_conditional_expr): Merged const and volatile flags of incoming types.
authorRichard Stallman <rms@gnu.org>
Tue, 4 Aug 1992 19:36:44 +0000 (19:36 +0000)
committerRichard Stallman <rms@gnu.org>
Tue, 4 Aug 1992 19:36:44 +0000 (19:36 +0000)
From-SVN: r1767

gcc/c-typeck.c

index ac8e48e3a1ba2ae20bd9be54d84bd35ec848e58d..52c3c211750e81e42b44a622609b5fd3f92d35ad 100644 (file)
@@ -3538,6 +3538,12 @@ build_conditional_expr (ifexp, op1, op2)
        }
     }
 
+  /* Merge const and volatile flags of the incoming types.  */
+  result_type
+    = build_type_variant (result_type,
+                         TYPE_READONLY (op1) || TYPE_READONLY (op2),
+                         TYPE_VOLATILE (op1) || TYPE_VOLATILE (op2));
+    
   if (result_type != TREE_TYPE (op1))
     op1 = convert (result_type, op1);
   if (result_type != TREE_TYPE (op2))