view gcc/testsuite/c-c++-common/pr58346-3.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* 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));
}