Chris Lattner | 7380466 | 2008-02-21 01:42:41 +0000 | [diff] [blame] | 1 | // RUN: clang %s -fsyntax-only -verify |
| 2 | |
| 3 | #define _AS1 __attribute__((address_space(1))) |
| 4 | #define _AS2 __attribute__((address_space(2))) |
| 5 | #define _AS3 __attribute__((address_space(3))) |
| 6 | |
| 7 | void foo(_AS3 float *a) { |
| 8 | _AS2 *x; |
| 9 | _AS1 float * _AS2 *B; |
| 10 | |
Nate Begeman | c8e89a8 | 2008-03-14 18:07:10 +0000 | [diff] [blame] | 11 | int _AS1 _AS2 *Y; // expected-error {{multiple address spaces specified for type}} |
Chris Lattner | 7380466 | 2008-02-21 01:42:41 +0000 | [diff] [blame] | 12 | int *_AS1 _AS2 *Z; // expected-error {{multiple address spaces specified for type}} |
| 13 | |
Nate Begeman | c8e89a8 | 2008-03-14 18:07:10 +0000 | [diff] [blame] | 14 | _AS1 int local; // expected-error {{automatic variable qualified with an address space}} |
Nate Begeman | 8e7dafe | 2008-03-25 18:36:32 +0000 | [diff] [blame] | 15 | _AS1 int array[5]; // expected-error {{automatic variable qualified with an address space}} |
| 16 | _AS1 int arrarr[5][5]; // expected-error {{automatic variable qualified with an address space}} |
Nate Begeman | 5af27e0 | 2008-03-14 00:22:18 +0000 | [diff] [blame] | 17 | |
Chris Lattner | 7380466 | 2008-02-21 01:42:41 +0000 | [diff] [blame] | 18 | *a = 5.0f; |
| 19 | } |
Chris Lattner | 863ea9a | 2009-01-12 00:08:58 +0000 | [diff] [blame^] | 20 | |
| 21 | struct _st { |
| 22 | int x, y; |
| 23 | } s __attribute ((address_space(1))) = {1, 1}; |
| 24 | |