summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/lvalue-6.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-18 22:34:10 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-18 22:34:10 +0000
commit1b157e431c5890768ac6cb4f6f93906258a618f5 (patch)
tree77e977c132707d7acd5acdad294ab595d741a594 /gcc/testsuite/gcc.dg/lvalue-6.c
parent855225481e6a82ff317d14c9484a53faf40a98ca (diff)
downloadgcc-1b157e431c5890768ac6cb4f6f93906258a618f5.tar.gz
PR c/22367
* c-typeck.c (build_unary_op): Check for taking address of expression of type void. testsuite: * gcc.dg/lvalue-6.c, gcc.dg/lvalue-7.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146332 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/lvalue-6.c')
-rw-r--r--gcc/testsuite/gcc.dg/lvalue-6.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/lvalue-6.c b/gcc/testsuite/gcc.dg/lvalue-6.c
new file mode 100644
index 00000000000..af69de4df4c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lvalue-6.c
@@ -0,0 +1,17 @@
+/* Test constraints on unary '&': PR 22367. */
+
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1990 -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" } */
+/* { dg-error "taking address of expression of type 'void'" "C90 only error" { target *-*-* } 10 } */
+
+extern const void cv;
+void f3 (void) { &cv; }
+
+extern const void *pcv;
+void f4 (void) { &*pcv; } /* { dg-warning "dereferencing" } */