1 // RUN
: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std
=CL2.0
2 // RUN
: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std
=clc
++1.0
6 local int G4
= 0; // expected-error{{program scope variable must reside in global or constant address space}}
8 static float g_implicit_static_var
= 0;
9 static constant float g_constant_static_var
= 0;
10 static global float g_global_static_var
= 0;
11 static local float g_local_static_var
= 0; // expected-error {{program scope variable must reside in global or constant address space}}
12 static private float g_private_static_var
= 0; // expected-error {{program scope variable must reside in global or constant address space}}
13 static generic float g_generic_static_var
= 0; // expected-error {{program scope variable must reside in global or constant address space}}
15 extern float g_implicit_extern_var
;
16 extern constant float g_constant_extern_var
;
17 extern global float g_global_extern_var
;
18 extern local float g_local_extern_var
; // expected-error {{extern variable must reside in global or constant address space}}
19 extern private float g_private_extern_var
; // expected-error {{extern variable must reside in global or constant address space}}
20 extern generic float g_generic_extern_var
; // expected-error {{extern variable must reside in global or constant address space}}
22 static void kernel bar
(void) { // expected-error
{{kernel functions cannot be declared static
}}
25 void kernel foo
(void) {
28 global int L3
; // expected-error{{function scope variable cannot be declared in global address space}}
29 generic int L4
; // expected-error{{automatic variable qualified with an invalid address space}}
30 __attribute__
((address_space(100))) int L5
; // expected-error{{automatic variable qualified with an invalid address space}}
32 static float l_implicit_static_var
= 0;
33 static constant float l_constant_static_var
= 0;
34 static global float l_global_static_var
= 0;
35 static local float l_local_static_var
= 0; // expected-error {{static local variable must reside in global or constant address space}}
36 static private float l_private_static_var
= 0; // expected-error {{static local variable must reside in global or constant address space}}
37 static generic float l_generic_static_var
= 0; // expected-error {{static local variable must reside in global or constant address space}}
39 extern float l_implicit_extern_var
;
40 extern constant float l_constant_extern_var
;
41 extern global float l_global_extern_var
;
42 extern local float l_local_extern_var
; // expected-error {{extern variable must reside in global or constant address space}}
43 extern private float l_private_extern_var
; // expected-error {{extern variable must reside in global or constant address space}}
44 extern generic float l_generic_extern_var
; // expected-error {{extern variable must reside in global or constant address space}}