]> granicus.if.org Git - clang/commitdiff
add some semantic checks for address spaces.
authorChris Lattner <sabre@nondot.org>
Thu, 21 Feb 2008 01:42:41 +0000 (01:42 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 21 Feb 2008 01:42:41 +0000 (01:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47423 91177308-0d34-0410-b5e6-96231b3b80d8

test/Sema/address_spaces.c [new file with mode: 0644]

diff --git a/test/Sema/address_spaces.c b/test/Sema/address_spaces.c
new file mode 100644 (file)
index 0000000..7171567
--- /dev/null
@@ -0,0 +1,15 @@
+// RUN: clang %s -fsyntax-only -verify
+
+#define _AS1 __attribute__((address_space(1)))
+#define _AS2 __attribute__((address_space(2)))
+#define _AS3 __attribute__((address_space(3)))
+
+void foo(_AS3 float *a) {
+  _AS2 *x;
+  _AS1 float * _AS2 *B;
+
+  int _AS1 _AS2 *Y;  // expected-error {{multiple address spaces specified for type}}
+  int *_AS1 _AS2 *Z;  // expected-error {{multiple address spaces specified for type}}
+
+  *a = 5.0f;
+}