summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/void-cast-1.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-27 21:41:15 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-27 21:41:15 +0000
commit778e3b560e7e231725b49cab0b886ab2f44f5bff (patch)
treece276778b8df2b8bd816052b690271a7aecc28d3 /gcc/testsuite/gcc.dg/void-cast-1.c
parent4d0e931faa7ab6bb3ebe39347667b74ffd1c460d (diff)
downloadgcc-778e3b560e7e231725b49cab0b886ab2f44f5bff.tar.gz
PR c/21159
* c-typeck.c (build_compound_expr): Don't warn for left-hand side being a compound expression whose right-hand side is cast to void. testsuite: * gcc.dg/void-cast-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98886 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/void-cast-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/void-cast-1.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/void-cast-1.c b/gcc/testsuite/gcc.dg/void-cast-1.c
new file mode 100644
index 00000000000..bd4e7b3bf7a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/void-cast-1.c
@@ -0,0 +1,11 @@
+/* Don't warn where the left-hand side of a comma expression is a
+ comma expression whose right-hand side is cast to void. Bug
+ 21159. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+int a, b, c, d;
+int e(void) { return (void)a, b; }
+int f(void) { return (void)a, (void)b, c; }
+int g(void) { return (void)a, (void)b, (void)c, d; }