1 // RUN: %clang_cc1 -std=c++14 %s -triple nvptx64-nvidia-cuda \
2 // RUN: -fcuda-is-device -verify -fsyntax-only
3 // RUN: %clang_cc1 -std=c++17 %s -triple nvptx64-nvidia-cuda \
4 // RUN: -fcuda-is-device -verify -fsyntax-only
5 // RUN: %clang_cc1 -std=c++14 %s \
6 // RUN: -triple x86_64-unknown-linux-gnu -verify -fsyntax-only
7 // RUN: %clang_cc1 -std=c++17 %s \
8 // RUN: -triple x86_64-unknown-linux-gnu -verify -fsyntax-only
9 #include "Inputs/cuda.h"
12 __host__ __device__ void foo(const T **a) {
13 // expected-note@-1 {{declared here}}
14 static const T b = sizeof(a);
15 static constexpr T c = sizeof(a);
16 const T d = sizeof(a);
17 constexpr T e = sizeof(a);
19 // expected-error@-1 {{constexpr variable 'f' must be initialized by a constant expression}}
20 // expected-note@-2 {{}}
27 __device__ void device_fun(const int **a) {
28 // expected-note@-1 {{declared here}}
29 constexpr int b = sizeof(a);
30 static constexpr int c = sizeof(a);
31 constexpr int d = **a;
32 // expected-error@-1 {{constexpr variable 'd' must be initialized by a constant expression}}
33 // expected-note@-2 {{}}
37 // expected-note@-1 {{in instantiation of function template specialization 'foo<int>' requested here}}
40 void host_fun(const int **a) {
41 // expected-note@-1 {{declared here}}
42 constexpr int b = sizeof(a);
43 static constexpr int c = sizeof(a);
44 constexpr int d = **a;
45 // expected-error@-1 {{constexpr variable 'd' must be initialized by a constant expression}}
46 // expected-note@-2 {{}}
52 __host__ __device__ void host_device_fun(const int **a) {
53 // expected-note@-1 {{declared here}}
54 constexpr int b = sizeof(a);
55 static constexpr int c = sizeof(a);
56 constexpr int d = **a;
57 // expected-error@-1 {{constexpr variable 'd' must be initialized by a constant expression}}
58 // expected-note@-2 {{}}
66 explicit A() = default;
72 static constexpr bool value = true;
77 static constexpr bool value = T::value;
80 __constant__ const bool &x = C<B>::value;