3 const signed char Ch2
= 'b';
4 const unsigned char Ch3
= 'c';
6 const wchar_t Ch4
= L
'd';
7 const signed wchar_t Ch5
= L
'e';
8 const unsigned wchar_t Ch6
= L
'f';
11 const unsigned short C2
= 13;
14 const unsigned int C4
= 13;
17 const unsigned long C6
= 23;
19 const long long C7
= 66;
20 const unsigned long long C8
= 67;
24 const char str1
[] = "ABCD";
25 const char str2
[] = "ABCD" "0123";
27 const wchar_t wstr1
[] = L
"DEF";
28 const wchar_t wstr2
[] = L
"DEF" L
"123";
32 const bool bval1
= true;
33 const bool bval2
= false;
36 const float F1
= 12.2F
;
37 const double F2
= 1E4
;
38 const long double F3
= 1.2E-3L;
42 const void *vptr
= nullptr;
45 int glb_1
[4] = { 10, 20, 30, 40 };
57 S2 glb_2
= { 22, .d
.a
= 44, .d
.b
[0] = 55, .d
.b
[1] = 66 };
59 void testNewThrowDelete() {
61 char *p
= new char[10];
65 int testArrayElement(int *x
, int n
) {
69 int testTernaryOp(int c
, int x
, int y
) {
73 S1
&testConstCast(const S1
&x
) {
74 return const_cast<S1
&>(x
);
77 S1
&testStaticCast(S1
&x
) {
78 return static_cast<S1
&>(x
);
81 S1
&testReinterpretCast(S1
&x
) {
82 return reinterpret_cast<S1
&>(x
);
85 S1
&testDynamicCast(S1
&x
) {
86 return dynamic_cast<S1
&>(x
);
89 int testScalarInit(int x
) {
102 void testOffsetOf() {
103 __builtin_offsetof(struct T
, s
[2].d
);
107 int testDefaultArg(int a
= 2*2) {
111 int testDefaultArgExpr() {
112 return testDefaultArg();
115 template <typename T
> // T has TemplateTypeParmType
116 void testTemplateTypeParmType(int i
);
118 void useTemplateType() {
119 testTemplateTypeParmType
<char>(4);
122 const bool ExpressionTrait
= __is_lvalue_expr(1);
123 const unsigned ArrayRank
= __array_rank(int[10][20]);
124 const unsigned ArrayExtent
= __array_extent(int[10][20], 1);
126 constexpr int testLambdaAdd(int toAdd
) {
127 const int Captured1
= 1, Captured2
= 2;
128 constexpr auto LambdaAdd
= [Captured1
, Captured2
](int k
) -> int {
129 return Captured1
+ Captured2
+ k
;
131 return LambdaAdd(toAdd
);
135 struct TestLambdaTemplate
{
137 TestLambdaTemplate(T i
, const T
&j
) : i(i
), j(j
) {}
139 return [this](T k
) -> decltype(auto) { return i
+ j
+ k
; }(k
);