From 7380466f2e9a5c835344454444cd3ad89ccca6e6 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 21 Feb 2008 01:42:41 +0000 Subject: [PATCH] add some semantic checks for address spaces. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47423 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Sema/address_spaces.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/Sema/address_spaces.c diff --git a/test/Sema/address_spaces.c b/test/Sema/address_spaces.c new file mode 100644 index 0000000000..7171567d63 --- /dev/null +++ b/test/Sema/address_spaces.c @@ -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; +}