diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/lvalue-7.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/lvalue-7.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/lvalue-7.c b/gcc/testsuite/gcc.dg/lvalue-7.c new file mode 100644 index 00000000000..37964e1cd76 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lvalue-7.c @@ -0,0 +1,16 @@ +/* Test constraints on unary '&': PR 22367. */ + +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +extern void v; +void f1 (void) { &v; } /* { dg-error "taking address of expression of type 'void'" } */ + +extern void *pv; +void f2 (void) { &*pv; } /* { dg-warning "dereferencing" } */ + +extern const void cv; +void f3 (void) { &cv; } + +extern const void *pcv; +void f4 (void) { &*pcv; } /* { dg-warning "dereferencing" } */ |