summaryrefslogtreecommitdiffstats
path: root/clang/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
commit48d52848d75fc5a2c174156d6d38a247723854a5 (patch)
tree52205820048a077ae39cdeca77319a5a96797101 /clang/test/Sema/expr-address-of.c
parentb8a47244acea2612a6eeb2aef729916847905a28 (diff)
downloadbcm5719-llvm-48d52848d75fc5a2c174156d6d38a247723854a5.tar.gz
bcm5719-llvm-48d52848d75fc5a2c174156d6d38a247723854a5.zip
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. llvm-svn: 44190
Diffstat (limited to 'clang/test/Sema/expr-address-of.c')
-rw-r--r--clang/test/Sema/expr-address-of.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Sema/expr-address-of.c b/clang/test/Sema/expr-address-of.c
new file mode 100644
index 00000000000..f085b6012a0
--- /dev/null
+++ b/clang/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}}
+}
+
+
OpenPOWER on IntegriCloud