| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify=host,com -x hip %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify=dev,com -x hip %s |
| 3 |
|
| 4 |
#include "Inputs/cuda.h" |
| 5 |
|
| 6 |
template<typename T> |
| 7 |
__device__ int fun1(T x) { |
| 8 |
// Check type-dependent constant is allowed in initializer. |
| 9 |
static __device__ int a = sizeof(x); |
| 10 |
static __device__ int b = x; |
| 11 |
// com-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} |
| 12 |
return a + b; |
| 13 |
} |
| 14 |
|
| 15 |
__device__ int fun1_caller() { |
| 16 |
return fun1(1); |
| 17 |
// com-note@-1 {{in instantiation of function template specialization 'fun1<int>' requested here}} |
| 18 |
} |