summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/void-cast-1.c
diff options
context:
space:
mode:
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 000000000..bd4e7b3bf
--- /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; }