aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/expr-address-of.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-16 17:46:48 +0000
committerChris Lattner <sabre@nondot.org>2007-11-16 17:46:48 +0000
commitf82228f6ed2b4bb195a519afa777ba521b5c62df (patch)
tree5abc81727ba6db57e5d46e875bb8154e83fb25cf /test/Sema/expr-address-of.c
parent825502a9ee613fdfb73b84cc85b9fdc58e680d86 (diff)
Tighten up address-of checking, implementing test/Sema/expr-address-of.c.
This fixes a bug reported by Seo Sanghyeon. This was meant to be committed yesterday, but the commit failed. doh. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44190 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/expr-address-of.c')
-rw-r--r--test/Sema/expr-address-of.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Sema/expr-address-of.c b/test/Sema/expr-address-of.c
new file mode 100644
index 0000000000..f085b6012a
--- /dev/null
+++ b/test/Sema/expr-address-of.c
@@ -0,0 +1,15 @@
+// RUN: clang %s -verify -fsyntax-only
+struct entry { int value; };
+void add_one(int *p) { (*p)++; }
+
+void test() {
+ register struct entry *p;
+ add_one(&p->value);
+}
+
+void foo() {
+ register int x[10];
+ &x[10]; // expected-error {{address of register variable requested}}
+}
+
+