blob: 9fd7bbba593c959b9712f68edef3eb6ed28e436a [file] [log] [blame]
Justin Lebar10411012016-09-30 23:57:30 +00001// 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 Lebar281ce2a2016-10-02 15:24:50 +00008 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 Lebar10411012016-09-30 23:57:30 +000012}
13
14__host__ __device__ void bar() {
Justin Lebar281ce2a2016-10-02 15:24:50 +000015 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 Lebar10411012016-09-30 23:57:30 +000019}
20
21extern __shared__ int global; // expected-error {{__shared__ variable 'global' cannot be 'extern'}}
Justin Lebar281ce2a2016-10-02 15:24:50 +000022extern __shared__ int global_arr[]; // ok
23extern __shared__ int global_arr1[1]; // expected-error {{__shared__ variable 'global_arr1' cannot be 'extern'}}