expressions as lvalues.
(internal_build_compound_expr): Remove special handling for
non-pedantic case.
* doc/extend.texi: Document that all extended lvalues are now
deprecated.
testsuite:
* gcc.dg/compound-lvalue-1.c: New test.
* gcc.dg/c90-const-expr-2.c, gcc.dg/c99-const-expr-2.c: Remove
some XFAILs.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73352
138bc75d-0d04-0410-961f-
82ee72b054a4
+2003-11-08 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * c-typeck.c (pedantic_lvalue_warning): Deprecate compound
+ expressions as lvalues.
+ (internal_build_compound_expr): Remove special handling for
+ non-pedantic case.
+ * doc/extend.texi: Document that all extended lvalues are now
+ deprecated.
+
2003-11-07 Geoffrey Keating <geoffk@apple.com>
PR 11654
pedwarn ("use of conditional expressions as lvalues is deprecated");
break;
case COMPOUND_EXPR:
- if (pedantic)
- pedwarn ("ISO C forbids use of compound expressions as lvalues");
+ pedwarn ("use of compound expressions as lvalues is deprecated");
break;
default:
pedwarn ("use of cast expressions as lvalues is deprecated");
&& ! (TREE_CODE (TREE_VALUE (list)) == CONVERT_EXPR
&& VOID_TYPE_P (TREE_TYPE (TREE_VALUE (list)))))
warning ("left-hand operand of comma expression has no effect");
-
- /* When pedantic, a compound expression can be neither an lvalue
- nor an integer constant expression. */
- if (! pedantic)
- return rest;
}
/* With -Wunused, we should also warn if the left-hand operand does have
Compound expressions, conditional expressions and casts are allowed as
lvalues provided their operands are lvalues. This means that you can take
-their addresses or store values into them.
+their addresses or store values into them. All these extensions are
+deprecated.
Standard C++ allows compound expressions and conditional expressions
as lvalues, and permits casts to reference type, so use of this
+2003-11-08 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * gcc.dg/compound-lvalue-1.c: New test.
+ * gcc.dg/c90-const-expr-2.c, gcc.dg/c99-const-expr-2.c: Remove
+ some XFAILs.
+
2003-11-06 Geoffrey Keating <geoffk@apple.com>
* gcc.dg/altivec-varargs-1.c: New test.
ASSERT_NPC ((void *)0);
ASSERT_NOT_NPC ((void *)(void *)0); /* { dg-bogus "incompatible" "bogus null pointer constant" { xfail *-*-* } } */
ASSERT_NOT_NPC ((void *)(char *)0); /* { dg-bogus "incompatible" "bogus null pointer constant" { xfail *-*-* } } */
- ASSERT_NOT_NPC ((void *)(0, 0)); /* { dg-bogus "incompatible" "bogus null pointer constant" { xfail *-*-* } } */
+ ASSERT_NOT_NPC ((void *)(0, 0)); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
ASSERT_NOT_NPC ((void *)(&"Foobar"[0] - &"Foobar"[0])); /* { dg-bogus "incompatible" "bogus null pointer constant" { xfail *-*-* } } */
/* This last one is a null pointer constant in C99 only. */
ASSERT_NOT_NPC ((void *)(1 ? 0 : (0, 0))); /* { dg-bogus "incompatible" "bogus null pointer constant" { xfail *-*-* } } */
ASSERT_NPC ((void *)0);
ASSERT_NOT_NPC ((void *)(void *)0); /* { dg-bogus "incompatible" "bogus null pointer constant" { xfail *-*-* } } */
ASSERT_NOT_NPC ((void *)(char *)0); /* { dg-bogus "incompatible" "bogus null pointer constant" { xfail *-*-* } } */
- ASSERT_NOT_NPC ((void *)(0, 0)); /* { dg-bogus "incompatible" "bogus null pointer constant" { xfail *-*-* } } */
+ ASSERT_NOT_NPC ((void *)(0, 0)); /* { dg-bogus "incompatible" "bogus null pointer constant" } */
ASSERT_NOT_NPC ((void *)(&"Foobar"[0] - &"Foobar"[0])); /* { dg-bogus "incompatible" "bogus null pointer constant" { xfail *-*-* } } */
/* This last one is a null pointer constant in C99 only. */
ASSERT_NPC ((void *)(1 ? 0 : (0, 0)));
--- /dev/null
+/* Test for deprecation of compound expressions as lvalues. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int x, y;
+
+void
+foo (void)
+{
+ (x, y) = 1; /* { dg-warning "lvalue" "compound expression as lvalue deprecated" } */
+}