Justin Lebar | 1041101 | 2016-09-30 23:57:30 +0000 | [diff] [blame] | 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'}} |
Justin Lebar | 281ce2a | 2016-10-02 15:24:50 +0000 | [diff] [blame] | 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'}} |
Justin Lebar | 1041101 | 2016-09-30 23:57:30 +0000 | [diff] [blame] | 12 | } |
| 13 | |
| 14 | __host__ __device__ void bar() { |
Justin Lebar | 281ce2a | 2016-10-02 15:24:50 +0000 | [diff] [blame] | 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'}} |
Justin Lebar | 1041101 | 2016-09-30 23:57:30 +0000 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | extern __shared__ int global; // expected-error {{__shared__ variable 'global' cannot be 'extern'}} |
Justin Lebar | 281ce2a | 2016-10-02 15:24:50 +0000 | [diff] [blame] | 22 | extern __shared__ int global_arr[]; // ok |
| 23 | extern __shared__ int global_arr1[1]; // expected-error {{__shared__ variable 'global_arr1' cannot be 'extern'}} |