c-typeck.c (build_unary_op): Invoke non_lvalue.
authorRichard Henderson <rth@redhat.com>
Fri, 26 Apr 2002 21:56:55 +0000 (14:56 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 26 Apr 2002 21:56:55 +0000 (14:56 -0700)
        * c-typeck.c (build_unary_op) [CONVERT_EXPR]: Invoke non_lvalue.
* gcc.dg/lvalue1.c: New.

From-SVN: r52812

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/gcc.dg/lvalue1.c [new file with mode: 0644]

index 05394caf8edd69641e6938656c0c98669a91f9e7..6a32a2106afef60295394765232f17c563d63ff7 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-26  Richard Henderson  <rth@redhat.com>
+
+       PR c/5225
+       * c-typeck.c (build_unary_op) [CONVERT_EXPR]: Invoke non_lvalue.
+
 2002-04-26  Mark Mitchell  <mark@codesourcery.com>
 
        PR bootstrap/6445
index f883801955722f2ee6823e8d4b04e12dc6399cd5..7e91d4fc69217d604f346c8ca8b680c952676b2d 100644 (file)
@@ -2759,6 +2759,7 @@ build_unary_op (code, xarg, flag)
        }
       else if (!noconvert)
        arg = default_conversion (arg);
+      arg = non_lvalue (arg);
       break;
 
     case NEGATE_EXPR:
diff --git a/gcc/testsuite/gcc.dg/lvalue1.c b/gcc/testsuite/gcc.dg/lvalue1.c
new file mode 100644 (file)
index 0000000..7e21608
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR c/5225 */
+/* { dg-do compile } */
+
+int main()
+{
+  int i;
+  +i = 1;      /* { dg-error "invalid lvalue in assignment" } */
+  return 0;
+}