Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/gcc.dg/pr25801.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/gcc.dg/pr25801.c Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,44 @@ +/* PR c/25801 */ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ + +int (*a)[]; +struct S *s; +union U *u; +enum E *e; + +void +f (void) +{ + a++; /* { dg-error "increment of pointer to an incomplete type" } */ + ++a; /* { dg-error "increment of pointer to an incomplete type" } */ + a--; /* { dg-error "decrement of pointer to an incomplete type" } */ + --a; /* { dg-error "decrement of pointer to an incomplete type" } */ + a += 1; /* { dg-error "invalid use of array with unspecified bounds" } */ + a -= 1; /* { dg-error "invalid use of array with unspecified bounds" } */ + a - a; /* { dg-error "arithmetic on pointer to an incomplete type" } */ + + s++; /* { dg-error "increment of pointer to an incomplete type" } */ + ++s; /* { dg-error "increment of pointer to an incomplete type" } */ + s--; /* { dg-error "decrement of pointer to an incomplete type" } */ + --s; /* { dg-error "decrement of pointer to an incomplete type" } */ + s += 1; /* { dg-error "invalid use of undefined type" } */ + s -= 1; /* { dg-error "invalid use of undefined type" } */ + s - s; /* { dg-error "arithmetic on pointer to an incomplete type" } */ + + u++; /* { dg-error "increment of pointer to an incomplete type" } */ + ++u; /* { dg-error "increment of pointer to an incomplete type" } */ + u--; /* { dg-error "decrement of pointer to an incomplete type" } */ + --u; /* { dg-error "decrement of pointer to an incomplete type" } */ + u += 1; /* { dg-error "invalid use of undefined type" } */ + u -= 1; /* { dg-error "invalid use of undefined type" } */ + u - u; /* { dg-error "arithmetic on pointer to an incomplete type" } */ + + e++; /* { dg-error "increment of pointer to an incomplete type" } */ + ++e; /* { dg-error "increment of pointer to an incomplete type" } */ + e--; /* { dg-error "decrement of pointer to an incomplete type" } */ + --e; /* { dg-error "decrement of pointer to an incomplete type" } */ + e += 1; /* { dg-error "invalid use of undefined type" } */ + e -= 1; /* { dg-error "invalid use of undefined type" } */ + e - e; /* { dg-error "arithmetic on pointer to an incomplete type" } */ +}