aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c
new file mode 100644
index 000000000..41627ed95
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr58346-3.c
@@ -0,0 +1,16 @@
+/* PR c/58346 */
+/* { dg-do compile } */
+
+void
+foo (void)
+{
+ __PTRDIFF_TYPE__ d;
+ const int i = 0;
+ int a1[2][0], a2[2][0];
+ int b1[3][i], b2[4][i];
+ d = a1 - a2; /* { dg-error "arithmetic on pointer to an empty aggregate" } */
+ __asm volatile ("" : "+g" (d));
+ /* No error here for C. */
+ d = b1 - b2; /* { dg-error "arithmetic on pointer to an empty aggregate" "" { target c++ } } */
+ __asm volatile ("" : "+g" (d));
+}