| 1 |
/+ |
| 2 |
REQUIRED_ARGS: -HC -c -o- |
| 3 |
PERMUTE_ARGS: |
| 4 |
TEST_OUTPUT: |
| 5 |
--- |
| 6 |
// Automatically generated by Digital Mars D Compiler |
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include <assert.h> |
| 11 |
#include <math.h> |
| 12 |
#include <stddef.h> |
| 13 |
#include <stdint.h> |
| 14 |
|
| 15 |
struct S final |
| 16 |
{ |
| 17 |
int32_t i; |
| 18 |
int32_t get(int32_t , int32_t ); |
| 19 |
static int32_t get(); |
| 20 |
static const int32_t staticVar; |
| 21 |
void useVars(int32_t pi = i, int32_t psv = S::staticVar); |
| 22 |
struct Nested final |
| 23 |
{ |
| 24 |
void useStaticVar(int32_t i = S::staticVar); |
| 25 |
Nested() |
| 26 |
{ |
| 27 |
} |
| 28 |
}; |
| 29 |
|
| 30 |
S() : |
| 31 |
i() |
| 32 |
{ |
| 33 |
} |
| 34 |
S(int32_t i) : |
| 35 |
i(i) |
| 36 |
{} |
| 37 |
}; |
| 38 |
|
| 39 |
extern "C" int32_t bar(int32_t x); |
| 40 |
|
| 41 |
extern "C" int32_t bar2(int32_t x); |
| 42 |
|
| 43 |
extern "C" int32_t bar4(int32_t x = 42); |
| 44 |
|
| 45 |
extern int32_t baz(int32_t x); |
| 46 |
|
| 47 |
extern int32_t baz2(int32_t x); |
| 48 |
|
| 49 |
extern int32_t baz4(int32_t x = 42); |
| 50 |
|
| 51 |
extern size_t baz5(size_t x = 42); |
| 52 |
|
| 53 |
extern size_t& bazRef(size_t& x); |
| 54 |
|
| 55 |
extern size_t bazOut(size_t& x); |
| 56 |
|
| 57 |
enum class E : int64_t |
| 58 |
{ |
| 59 |
m = 1LL, |
| 60 |
}; |
| 61 |
|
| 62 |
enum class MS : uint8_t |
| 63 |
{ |
| 64 |
dm = 0u, |
| 65 |
}; |
| 66 |
|
| 67 |
namespace MSN |
| 68 |
{ |
| 69 |
static S const s = S(42); |
| 70 |
}; |
| 71 |
|
| 72 |
struct W1 final |
| 73 |
{ |
| 74 |
MS ms; |
| 75 |
/* MSN */ S msn; |
| 76 |
W1() |
| 77 |
{ |
| 78 |
} |
| 79 |
W1(MS ms, /* MSN */ S msn = S(42)) : |
| 80 |
ms(ms), |
| 81 |
msn(msn) |
| 82 |
{} |
| 83 |
}; |
| 84 |
|
| 85 |
struct W2 final |
| 86 |
{ |
| 87 |
W1 w1; |
| 88 |
W2() : |
| 89 |
w1() |
| 90 |
{ |
| 91 |
} |
| 92 |
W2(W1 w1) : |
| 93 |
w1(w1) |
| 94 |
{} |
| 95 |
}; |
| 96 |
|
| 97 |
extern W2 w2; |
| 98 |
|
| 99 |
extern void enums(uint64_t e = $?:32=1LLU|64=static_cast<uint64_t>(E::m)$, uint8_t e2 = static_cast<uint8_t>(w2.w1.ms), S s = static_cast<S>(w2.w1.msn)); |
| 100 |
|
| 101 |
extern S s; |
| 102 |
|
| 103 |
extern void aggregates(int32_t a = s.i, int32_t b = s.get(1, 2), int32_t c = S::get(), int32_t d = S::staticVar); |
| 104 |
|
| 105 |
struct S2 final |
| 106 |
{ |
| 107 |
S s; |
| 108 |
struct S3 final |
| 109 |
{ |
| 110 |
static int32_t i; |
| 111 |
S3() |
| 112 |
{ |
| 113 |
} |
| 114 |
}; |
| 115 |
|
| 116 |
S2() : |
| 117 |
s() |
| 118 |
{ |
| 119 |
} |
| 120 |
S2(S s) : |
| 121 |
s(s) |
| 122 |
{} |
| 123 |
}; |
| 124 |
|
| 125 |
extern S2 s2; |
| 126 |
|
| 127 |
extern void chains(int32_t a = s2.s.i, int32_t b = S2::S3::i); |
| 128 |
|
| 129 |
extern S* ptr; |
| 130 |
|
| 131 |
extern int32_t(*f)(int32_t ); |
| 132 |
|
| 133 |
extern void special(int32_t a = ptr->i, int32_t b = ptr->get(1, 2), int32_t j = (*f)(1)); |
| 134 |
|
| 135 |
extern void variadic(int32_t __param_0_, ...); |
| 136 |
--- |
| 137 |
+/ |
| 138 |
|
| 139 |
int foo(int x) |
| 140 |
{ |
| 141 |
return x * 42; |
| 142 |
} |
| 143 |
|
| 144 |
extern (C) int fun(); |
| 145 |
extern (C++) int fun2(); |
| 146 |
|
| 147 |
extern (C) int bar(int x) |
| 148 |
{ |
| 149 |
return x * 42; |
| 150 |
} |
| 151 |
|
| 152 |
extern (C) static int bar2(int x) |
| 153 |
{ |
| 154 |
return x * 42; |
| 155 |
} |
| 156 |
|
| 157 |
extern (C) private int bar3(int x) |
| 158 |
{ |
| 159 |
return x * 42; |
| 160 |
} |
| 161 |
|
| 162 |
extern (C) int bar4(int x = 42) |
| 163 |
{ |
| 164 |
return x * 42; |
| 165 |
} |
| 166 |
|
| 167 |
extern (C++) int baz(int x) |
| 168 |
{ |
| 169 |
return x * 42; |
| 170 |
} |
| 171 |
|
| 172 |
extern (C++) static int baz2(int x) |
| 173 |
{ |
| 174 |
return x * 42; |
| 175 |
} |
| 176 |
|
| 177 |
extern (C++) private int baz3(int x) |
| 178 |
{ |
| 179 |
return x * 42; |
| 180 |
} |
| 181 |
|
| 182 |
extern (C++) int baz4(int x = 42) |
| 183 |
{ |
| 184 |
return x * 42; |
| 185 |
} |
| 186 |
|
| 187 |
extern (C++) size_t baz5(size_t x = 42) |
| 188 |
{ |
| 189 |
return x * 42; |
| 190 |
} |
| 191 |
|
| 192 |
extern (C++) ref size_t bazRef(return ref size_t x) |
| 193 |
{ |
| 194 |
return x; |
| 195 |
} |
| 196 |
|
| 197 |
extern (C++) size_t bazOut(out size_t x) |
| 198 |
{ |
| 199 |
return x; |
| 200 |
} |
| 201 |
|
| 202 |
extern (C++): |
| 203 |
|
| 204 |
enum E : long |
| 205 |
{ |
| 206 |
m = 1 |
| 207 |
} |
| 208 |
|
| 209 |
enum MS : ubyte { dm } |
| 210 |
enum MSN : S { s = S(42) } |
| 211 |
struct W1 { MS ms; MSN msn; } |
| 212 |
struct W2 { W1 w1; } |
| 213 |
__gshared W2 w2; |
| 214 |
|
| 215 |
void enums(ulong e = E.m, ubyte e2 = w2.w1.ms, S s = w2.w1.msn) {} |
| 216 |
|
| 217 |
struct S |
| 218 |
{ |
| 219 |
int i; |
| 220 |
int get(int, int); |
| 221 |
static int get(); |
| 222 |
__gshared const int staticVar; |
| 223 |
|
| 224 |
void useVars(int pi = i, int psv = staticVar) {} |
| 225 |
|
| 226 |
struct Nested |
| 227 |
{ |
| 228 |
void useStaticVar(int i = staticVar) {} |
| 229 |
} |
| 230 |
} |
| 231 |
|
| 232 |
__gshared S s; |
| 233 |
|
| 234 |
void aggregates(int a = s.i, int b = s.get(1, 2), int c = S.get(), int d = S.staticVar) {} |
| 235 |
|
| 236 |
struct S2 |
| 237 |
{ |
| 238 |
|
| 239 |
S s; |
| 240 |
static struct S3 |
| 241 |
{ |
| 242 |
__gshared int i = 3; |
| 243 |
} |
| 244 |
} |
| 245 |
|
| 246 |
__gshared S2 s2; |
| 247 |
|
| 248 |
void chains(int a = s2.s.i, int b = S2.S3.i) {} |
| 249 |
|
| 250 |
__gshared S* ptr; |
| 251 |
__gshared int function(int) f; |
| 252 |
|
| 253 |
void special(int a = ptr.i, int b = ptr.get(1, 2), int j = f(1)) {} |
| 254 |
|
| 255 |
import core.stdc.stdarg; |
| 256 |
void variadic(int, ...) {} |