]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaCUDA/extern-shared.cu
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / SemaCUDA / extern-shared.cu
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s
3
4 #include "Inputs/cuda.h"
5
6 __device__ void foo() {
7   extern __shared__ int x; // expected-error {{__shared__ variable 'x' cannot be 'extern'}}
8   extern __shared__ int arr[];  // ok
9   extern __shared__ int arr0[0]; // expected-error {{__shared__ variable 'arr0' cannot be 'extern'}}
10   extern __shared__ int arr1[1]; // expected-error {{__shared__ variable 'arr1' cannot be 'extern'}}
11   extern __shared__ int* ptr ; // expected-error {{__shared__ variable 'ptr' cannot be 'extern'}}
12 }
13
14 __host__ __device__ void bar() {
15   extern __shared__ int arr[];  // ok
16   extern __shared__ int arr0[0]; // expected-error {{__shared__ variable 'arr0' cannot be 'extern'}}
17   extern __shared__ int arr1[1]; // expected-error {{__shared__ variable 'arr1' cannot be 'extern'}}
18   extern __shared__ int* ptr ; // expected-error {{__shared__ variable 'ptr' cannot be 'extern'}}
19 }
20
21 extern __shared__ int global; // expected-error {{__shared__ variable 'global' cannot be 'extern'}}
22 extern __shared__ int global_arr[]; // ok
23 extern __shared__ int global_arr1[1]; // expected-error {{__shared__ variable 'global_arr1' cannot be 'extern'}}