| 1 |
// PERMUTE_ARGS: |
| 2 |
// EXTRA_SOURCES: imports/mangle10077.d |
| 3 |
// EXTRA_FILES: imports/testmangle.d |
| 4 |
// UNICODE_NAMES: |
| 5 |
/* |
| 6 |
TEST_OUTPUT: |
| 7 |
--- |
| 8 |
_D7imports10testmangle12detectMangleFPSQBlQBg6DetectZQq |
| 9 |
_D7imports10testmangle__T10DetectTmplTiZQpFNaNbNiNfZv |
| 10 |
true |
| 11 |
false |
| 12 |
--- |
| 13 |
*/ |
| 14 |
|
| 15 |
import imports.testmangle; |
| 16 |
|
| 17 |
/***************************************************/ |
| 18 |
// https://issues.dlang.org/show_bug.cgi?id=10077 |
| 19 |
// pragma(mangle) |
| 20 |
|
| 21 |
pragma(mangle, "_test10077a_") int test10077a; |
| 22 |
static assert(test10077a.mangleof == "_test10077a_"); |
| 23 |
|
| 24 |
__gshared pragma(mangle, "_test10077b_") ubyte test10077b; |
| 25 |
static assert(test10077b.mangleof == "_test10077b_"); |
| 26 |
|
| 27 |
pragma(mangle, "_test10077c_") void test10077c() {} |
| 28 |
static assert(test10077c.mangleof == "_test10077c_"); |
| 29 |
|
| 30 |
pragma(mangle, "_test10077f_") __gshared char test10077f; |
| 31 |
static assert(test10077f.mangleof == "_test10077f_"); |
| 32 |
|
| 33 |
pragma(mangle, "_test10077g_") @system { void test10077g() {} } |
| 34 |
static assert(test10077g.mangleof == "_test10077g_"); |
| 35 |
|
| 36 |
template getModuleInfo(alias mod) |
| 37 |
{ |
| 38 |
pragma(mangle, "_D"~mod.mangleof~"12__ModuleInfoZ") static __gshared extern ModuleInfo mi; |
| 39 |
enum getModuleInfo = &mi; |
| 40 |
} |
| 41 |
|
| 42 |
void test10077h() |
| 43 |
{ |
| 44 |
assert(getModuleInfo!(object).name == "object"); |
| 45 |
} |
| 46 |
|
| 47 |
//UTF-8 chars |
| 48 |
__gshared extern pragma(mangle, "test_эльфийские_письмена_9") ubyte test10077i_evar; |
| 49 |
|
| 50 |
void test10077i() |
| 51 |
{ |
| 52 |
import imports.mangle10077; |
| 53 |
|
| 54 |
setTest10077i(); |
| 55 |
assert(test10077i_evar == 42); |
| 56 |
} |
| 57 |
|
| 58 |
/***************************************************/ |
| 59 |
// https://issues.dlang.org/show_bug.cgi?id=13050 |
| 60 |
|
| 61 |
void func13050(int); |
| 62 |
template decl13050(Arg) |
| 63 |
{ |
| 64 |
void decl13050(Arg); |
| 65 |
} |
| 66 |
template problem13050(Arg) |
| 67 |
{ |
| 68 |
pragma(mangle, "foobar") |
| 69 |
void problem13050(Arg); |
| 70 |
} |
| 71 |
template workaround13050(Arg) |
| 72 |
{ |
| 73 |
pragma(mangle, "foobar") |
| 74 |
void func(Arg); |
| 75 |
alias workaround13050 = func; |
| 76 |
} |
| 77 |
|
| 78 |
static assert(is(typeof(&func13050) == void function(int))); |
| 79 |
static assert(is(typeof(&decl13050!int) == void function(int))); |
| 80 |
static assert(is(typeof(&problem13050!int) == void function(int))); |
| 81 |
static assert(is(typeof(&workaround13050!int) == void function(int))); |
| 82 |
|
| 83 |
/***************************************************/ |
| 84 |
// https://issues.dlang.org/show_bug.cgi?id=2774 |
| 85 |
|
| 86 |
int foo2774(int n) { return 0; } |
| 87 |
static assert(foo2774.mangleof == "_D6mangle7foo2774FiZi"); |
| 88 |
|
| 89 |
class C2774 |
| 90 |
{ |
| 91 |
int foo2774() { return 0; } |
| 92 |
} |
| 93 |
static assert(C2774.foo2774.mangleof == "_D6mangle5C27747foo2774MFZi"); |
| 94 |
|
| 95 |
template TFoo2774(T) {} |
| 96 |
static assert(TFoo2774!int.mangleof == "6mangle"~tl!"15"~"__T8TFoo2774TiZ"); |
| 97 |
|
| 98 |
void test2774() |
| 99 |
{ |
| 100 |
int foo2774(int n) { return 0; } |
| 101 |
static assert(foo2774.mangleof == "_D6mangle8test2774FZ7foo2774MFNaNbNiNfiZi"); |
| 102 |
} |
| 103 |
|
| 104 |
/*******************************************/ |
| 105 |
// https://issues.dlang.org/show_bug.cgi?id=8847 |
| 106 |
|
| 107 |
auto S8847() |
| 108 |
{ |
| 109 |
static struct Result |
| 110 |
{ |
| 111 |
inout(Result) get() inout { return this; } |
| 112 |
} |
| 113 |
return Result(); |
| 114 |
} |
| 115 |
|
| 116 |
void test8847a() |
| 117 |
{ |
| 118 |
auto a = S8847(); |
| 119 |
auto b = a.get(); |
| 120 |
alias typeof(a) A; |
| 121 |
alias typeof(b) B; |
| 122 |
assert(is(A == B), A.stringof~ " is different from "~B.stringof); |
| 123 |
} |
| 124 |
|
| 125 |
// -------- |
| 126 |
|
| 127 |
enum result8847a = "S6mangle9iota8847aFZ6Result"; |
| 128 |
enum result8847b = "S6mangle9iota8847bFZ4iotaMFZ6Result"; |
| 129 |
enum result8847c = "C6mangle9iota8847cFZ6Result"; |
| 130 |
enum result8847d = "C6mangle9iota8847dFZ4iotaMFZ6Result"; |
| 131 |
|
| 132 |
auto iota8847a() |
| 133 |
{ |
| 134 |
static struct Result |
| 135 |
{ |
| 136 |
this(int) {} |
| 137 |
inout(Result) test() inout { return cast(inout)Result(0); } |
| 138 |
} |
| 139 |
static assert(Result.mangleof == result8847a); |
| 140 |
return Result.init; |
| 141 |
} |
| 142 |
auto iota8847b() |
| 143 |
{ |
| 144 |
auto iota() |
| 145 |
{ |
| 146 |
static struct Result |
| 147 |
{ |
| 148 |
this(int) {} |
| 149 |
inout(Result) test() inout { return cast(inout)Result(0); } |
| 150 |
} |
| 151 |
static assert(Result.mangleof == result8847b); |
| 152 |
return Result.init; |
| 153 |
} |
| 154 |
return iota(); |
| 155 |
} |
| 156 |
auto iota8847c() |
| 157 |
{ |
| 158 |
static class Result |
| 159 |
{ |
| 160 |
this(int) {} |
| 161 |
inout(Result) test() inout { return cast(inout)new Result(0); } |
| 162 |
} |
| 163 |
static assert(Result.mangleof == result8847c); |
| 164 |
return Result.init; |
| 165 |
} |
| 166 |
auto iota8847d() |
| 167 |
{ |
| 168 |
auto iota() |
| 169 |
{ |
| 170 |
static class Result |
| 171 |
{ |
| 172 |
this(int) {} |
| 173 |
inout(Result) test() inout { return cast(inout)new Result(0); } |
| 174 |
} |
| 175 |
static assert(Result.mangleof == result8847d); |
| 176 |
return Result.init; |
| 177 |
} |
| 178 |
return iota(); |
| 179 |
} |
| 180 |
void test8847b() |
| 181 |
{ |
| 182 |
static assert(typeof(iota8847a().test()).mangleof == result8847a); |
| 183 |
static assert(typeof(iota8847b().test()).mangleof == result8847b); |
| 184 |
static assert(typeof(iota8847c().test()).mangleof == result8847c); |
| 185 |
static assert(typeof(iota8847d().test()).mangleof == result8847d); |
| 186 |
} |
| 187 |
|
| 188 |
// -------- |
| 189 |
|
| 190 |
struct Test8847 |
| 191 |
{ |
| 192 |
enum result1 = "S6mangle8Test8847"~tl!("8")~"__T3fooZ"~id!("3foo","Qf")~"MFZ6Result"; |
| 193 |
enum result2 = "S6mangle8Test8847"~tl!("8")~"__T3fooZ"~id!("3foo","Qf")~"MxFiZ6Result"; |
| 194 |
|
| 195 |
auto foo()() |
| 196 |
{ |
| 197 |
static struct Result |
| 198 |
{ |
| 199 |
inout(Result) get() inout { return this; } |
| 200 |
} |
| 201 |
static assert(Result.mangleof == Test8847.result1); |
| 202 |
return Result(); |
| 203 |
} |
| 204 |
auto foo()(int n) const |
| 205 |
{ |
| 206 |
static struct Result |
| 207 |
{ |
| 208 |
inout(Result) get() inout { return this; } |
| 209 |
} |
| 210 |
static assert(Result.mangleof == Test8847.result2); |
| 211 |
return Result(); |
| 212 |
} |
| 213 |
} |
| 214 |
void test8847c() |
| 215 |
{ |
| 216 |
static assert(typeof(Test8847().foo( ).get()).mangleof == Test8847.result1); |
| 217 |
static assert(typeof(Test8847().foo(1).get()).mangleof == Test8847.result2); |
| 218 |
} |
| 219 |
|
| 220 |
// -------- |
| 221 |
|
| 222 |
void test8847d() |
| 223 |
{ |
| 224 |
enum resultS = "S6mangle9test8847dFZ3fooMFZ3barMFZ3bazMFZ1S"; |
| 225 |
enum resultX = "S6mangle9test8847dFZ3fooMFZ1X"; |
| 226 |
// Return types for test8847d and bar are mangled correctly, |
| 227 |
// and return types for foo and baz are not mangled correctly. |
| 228 |
|
| 229 |
auto foo() |
| 230 |
{ |
| 231 |
struct X { inout(X) get() inout { return inout(X)(); } } |
| 232 |
string bar() |
| 233 |
{ |
| 234 |
auto baz() |
| 235 |
{ |
| 236 |
struct S { inout(S) get() inout { return inout(S)(); } } |
| 237 |
return S(); |
| 238 |
} |
| 239 |
static assert(typeof(baz() ).mangleof == resultS); |
| 240 |
static assert(typeof(baz().get()).mangleof == resultS); |
| 241 |
return ""; |
| 242 |
} |
| 243 |
return X(); |
| 244 |
} |
| 245 |
static assert(typeof(foo() ).mangleof == resultX); |
| 246 |
static assert(typeof(foo().get()).mangleof == resultX); |
| 247 |
} |
| 248 |
|
| 249 |
// -------- |
| 250 |
|
| 251 |
void test8847e() |
| 252 |
{ |
| 253 |
enum resultHere = "6mangle"~"9test8847eFZ"~tl!"8"~"__T3fooZ"~id!("3foo","Qf"); |
| 254 |
enum resultBar = "S"~resultHere~"MFNaNfNgiZ3Bar"; |
| 255 |
static if(BackRefs) {} else |
| 256 |
enum resultFoo = "_D"~resultHere~"MFNaNbNiNfNgiZNg"~resultBar; // added 'Nb' |
| 257 |
|
| 258 |
// Make template function to infer 'nothrow' attributes |
| 259 |
auto foo()(inout int) pure @safe |
| 260 |
{ |
| 261 |
struct Bar {} |
| 262 |
static assert(Bar.mangleof == resultBar); |
| 263 |
return inout(Bar)(); |
| 264 |
} |
| 265 |
|
| 266 |
import core.demangle : demangle, demangleType; |
| 267 |
auto bar = foo(0); |
| 268 |
static assert(typeof(bar).stringof == "Bar"); |
| 269 |
static assert(typeof(bar).mangleof == resultBar); |
| 270 |
enum fooDemangled = "pure nothrow @nogc @safe inout(mangle.test8847e().foo!().foo(inout(int)).Bar) mangle.test8847e().foo!().foo(inout(int))"; |
| 271 |
|
| 272 |
static if (BackRefs) |
| 273 |
static assert(demangle(foo!().mangleof) == fooDemangled); |
| 274 |
else |
| 275 |
static assert(foo!().mangleof == resultFoo); |
| 276 |
} |
| 277 |
|
| 278 |
// -------- |
| 279 |
|
| 280 |
pure f8847a() |
| 281 |
{ |
| 282 |
struct S {} |
| 283 |
return S(); |
| 284 |
} |
| 285 |
|
| 286 |
pure |
| 287 |
{ |
| 288 |
auto f8847b() |
| 289 |
{ |
| 290 |
struct S {} |
| 291 |
return S(); |
| 292 |
} |
| 293 |
} |
| 294 |
|
| 295 |
static assert(typeof(f8847a()).mangleof == "S6mangle6f8847aFNaZ1S"); |
| 296 |
static assert(typeof(f8847b()).mangleof == "S6mangle6f8847bFNaZ1S"); |
| 297 |
|
| 298 |
/*******************************************/ |
| 299 |
// https://issues.dlang.org/show_bug.cgi?id=12352 |
| 300 |
|
| 301 |
auto bar12352() |
| 302 |
{ |
| 303 |
struct S { int var; void func() {} } |
| 304 |
|
| 305 |
static assert(!__traits(compiles, bar12352.mangleof)); // forward reference to bar |
| 306 |
static assert(S .mangleof == "S6mangle8bar12352FZ1S"); |
| 307 |
static assert(S.func.mangleof == "_D6mangle8bar12352FZ1S4funcMFZv"); |
| 308 |
|
| 309 |
return S(); |
| 310 |
} |
| 311 |
static assert( bar12352 .mangleof == "_D6mangle8bar12352FNaNbNiNfZS"~id!("6mangle8bar12352FZ","QBbQxFZ","QL2H")~"1S"); |
| 312 |
static assert(typeof(bar12352()) .mangleof == "S6mangle8bar12352FZ1S"); |
| 313 |
static assert(typeof(bar12352()).func.mangleof == "_D6mangle8bar12352FZ1S4funcMFZv"); |
| 314 |
|
| 315 |
auto baz12352() |
| 316 |
{ |
| 317 |
class C { int var; void func() {} } |
| 318 |
|
| 319 |
static assert(!__traits(compiles, baz12352.mangleof)); // forward reference to baz |
| 320 |
static assert(C .mangleof == "C6mangle8baz12352FZ1C"); |
| 321 |
static assert(C.func.mangleof == "_D6mangle8baz12352FZ1C4funcMFZv"); |
| 322 |
|
| 323 |
return new C(); |
| 324 |
} |
| 325 |
static assert( baz12352 .mangleof == "_D6mangle8baz12352FNaNbNfZC"~id!("6mangle8baz12352FZ","QzQuFZ","QL2F")~"1C"); |
| 326 |
static assert(typeof(baz12352()) .mangleof == "C6mangle8baz12352FZ1C"); |
| 327 |
static assert(typeof(baz12352()).func.mangleof == "_D6mangle8baz12352FZ1C4funcMFZv"); |
| 328 |
|
| 329 |
/*******************************************/ |
| 330 |
// https://issues.dlang.org/show_bug.cgi?id=9525 |
| 331 |
|
| 332 |
void f9525(T)(in T*) { } |
| 333 |
|
| 334 |
void test9525() |
| 335 |
{ |
| 336 |
enum result1 = "S6mangle8test9525FZ"~tl!"26"~"__T5test1S"~tl!"13"~id!("6mangle","QBc")~"5f9525Z"~id!("5test1","Qr")~"MFZ1S"; |
| 337 |
enum result2 = "S6mangle8test9525FZ"~tl!"26"~"__T5test2S"~tl!"13"~id!("6mangle","QBc")~"5f9525Z"~id!("5test2","Qr")~"MFNaNbZ1S"; |
| 338 |
|
| 339 |
bool test1(alias a)() |
| 340 |
{ |
| 341 |
static struct S {} |
| 342 |
static assert(S.mangleof == result1); |
| 343 |
S s; |
| 344 |
a(&s); // Error: Cannot convert &S to const(S*) at compile time |
| 345 |
return true; |
| 346 |
} |
| 347 |
enum evalTest1 = test1!f9525(); |
| 348 |
|
| 349 |
bool test2(alias a)() pure nothrow |
| 350 |
{ |
| 351 |
static struct S {} |
| 352 |
static assert(S.mangleof == result2); |
| 353 |
S s; |
| 354 |
a(&s); // Error: Cannot convert &S to const(S*) at compile time |
| 355 |
return true; |
| 356 |
} |
| 357 |
enum evalTest2 = test2!f9525(); |
| 358 |
} |
| 359 |
|
| 360 |
/******************************************/ |
| 361 |
// https://issues.dlang.org/show_bug.cgi?id=10249 |
| 362 |
|
| 363 |
template Seq10249(T...) { alias Seq10249 = T; } |
| 364 |
|
| 365 |
mixin template Func10249(T) |
| 366 |
{ |
| 367 |
void func10249(T) {} |
| 368 |
} |
| 369 |
mixin Func10249!long; |
| 370 |
mixin Func10249!string; |
| 371 |
|
| 372 |
void f10249(long) {} |
| 373 |
|
| 374 |
class C10249 |
| 375 |
{ |
| 376 |
mixin Func10249!long; |
| 377 |
mixin Func10249!string; |
| 378 |
static assert(Seq10249!(.func10249)[0].mangleof == "6mangle9func10249"); // <- 9func10249 |
| 379 |
static assert(Seq10249!( func10249)[0].mangleof == "6mangle6C102499func10249"); // <- 9func10249 |
| 380 |
|
| 381 |
static: // necessary to make overloaded symbols accessible via __traits(getOverloads, C10249) |
| 382 |
void foo(long) {} |
| 383 |
void foo(string) {} |
| 384 |
static assert(Seq10249!(foo)[0].mangleof == "6mangle6C102493foo"); // <- _D6mangle6C102493fooFlZv |
| 385 |
static assert(Seq10249!(__traits(getOverloads, C10249, "foo"))[0].mangleof == "_D6mangle6C102493fooFlZv"); // <- |
| 386 |
static assert(Seq10249!(__traits(getOverloads, C10249, "foo"))[1].mangleof == "_D6mangle6C102493fooFAyaZv"); // <- |
| 387 |
|
| 388 |
void g(string) {} |
| 389 |
alias bar = .f10249; |
| 390 |
alias bar = g; |
| 391 |
static assert(Seq10249!(bar)[0].mangleof == "6mangle6C102493bar"); // <- _D6mangle1fFlZv |
| 392 |
static assert(Seq10249!(__traits(getOverloads, C10249, "bar"))[0].mangleof == "_D6mangle6f10249FlZv"); // <- |
| 393 |
static assert(Seq10249!(__traits(getOverloads, C10249, "bar"))[1].mangleof == "_D6mangle6C102491gFAyaZv"); // <- |
| 394 |
} |
| 395 |
|
| 396 |
/*******************************************/ |
| 397 |
// https://issues.dlang.org/show_bug.cgi?id=11718 |
| 398 |
|
| 399 |
struct Ty11718(alias sym) {} |
| 400 |
|
| 401 |
auto fn11718(T)(T a) { return Ty11718!(a).mangleof; } |
| 402 |
auto fn11718(T)() { T a; return Ty11718!(a).mangleof; } |
| 403 |
|
| 404 |
void test11718() |
| 405 |
{ |
| 406 |
string TyName(string tail)() |
| 407 |
{ |
| 408 |
enum s = "__T7Ty11718" ~ tail; |
| 409 |
enum len = unsignedToString(s.length); |
| 410 |
return "S6mangle" ~ tl!(len) ~ s; |
| 411 |
} |
| 412 |
string fnName(string paramPart)() |
| 413 |
{ |
| 414 |
enum s = "_D6mangle"~tl!("35")~"__T7fn11718T"~ |
| 415 |
"S6mangle9test11718FZ1AZ7fn11718"~paramPart~"1a"~ |
| 416 |
"S6mangle9test11718FZ1A"; |
| 417 |
enum len = unsignedToString(s.length); |
| 418 |
return tl!len ~ s; |
| 419 |
} |
| 420 |
enum result1 = TyName!("S" ~ fnName!("F"~"S6mangle9test11718FZ1A"~"Z") ~ "Z") ~ "7Ty11718"; |
| 421 |
enum result2 = TyName!("S" ~ fnName!("F"~"" ~"Z") ~ "Z") ~ "7Ty11718"; |
| 422 |
|
| 423 |
struct A {} |
| 424 |
static if (BackRefs) |
| 425 |
{ |
| 426 |
static assert(fn11718(A.init) == "S6mangle__T7Ty11718S_DQv__T7fn11718TSQBk9test11718FZ1AZQBcFQxZ1aQBcZQCf"); |
| 427 |
static assert(fn11718!A() == "S6mangle__T7Ty11718S_DQv__T7fn11718TSQBk9test11718FZ1AZQBcFZ1aQBaZQCd"); |
| 428 |
} |
| 429 |
else |
| 430 |
{ |
| 431 |
pragma(msg, fn11718(A.init)); |
| 432 |
static assert(fn11718(A.init) == result1); |
| 433 |
static assert(fn11718!A() == result2); |
| 434 |
} |
| 435 |
} |
| 436 |
|
| 437 |
/*******************************************/ |
| 438 |
// https://issues.dlang.org/show_bug.cgi?id=11776 |
| 439 |
|
| 440 |
struct S11776(alias fun) { } |
| 441 |
|
| 442 |
void test11776() |
| 443 |
{ |
| 444 |
auto g = () |
| 445 |
{ |
| 446 |
if (1) |
| 447 |
return; // fill tf->next |
| 448 |
if (1) |
| 449 |
{ |
| 450 |
auto s = S11776!(a => 1)(); |
| 451 |
enum expected = "S"~"6mangle"~tl!("56")~ |
| 452 |
("__T"~"6S11776"~"S"~tl!("42")~ |
| 453 |
(id!("6mangle","Qs")~"9test11776"~"FZ"~"17__lambda_L444_C14MFZ17__lambda_L450_C30")~"Z" |
| 454 |
)~id!("6S11776", "QCm"); |
| 455 |
static assert(typeof(s).mangleof == expected); |
| 456 |
} |
| 457 |
}; |
| 458 |
} |
| 459 |
|
| 460 |
/***************************************************/ |
| 461 |
// https://issues.dlang.org/show_bug.cgi?id=12044 |
| 462 |
|
| 463 |
struct S12044(T) |
| 464 |
{ |
| 465 |
void f()() |
| 466 |
{ |
| 467 |
new T[1]; |
| 468 |
} |
| 469 |
|
| 470 |
bool opEquals(O)(O) |
| 471 |
{ |
| 472 |
f(); |
| 473 |
} |
| 474 |
} |
| 475 |
|
| 476 |
void test12044() |
| 477 |
{ |
| 478 |
() |
| 479 |
{ |
| 480 |
enum E { e } |
| 481 |
auto arr = [E.e]; |
| 482 |
S12044!E s; |
| 483 |
} |
| 484 |
(); |
| 485 |
} |
| 486 |
|
| 487 |
/*******************************************/ |
| 488 |
// https://issues.dlang.org/show_bug.cgi?id=12217 |
| 489 |
|
| 490 |
void test12217(int) |
| 491 |
{ |
| 492 |
static struct S {} |
| 493 |
void bar() {} |
| 494 |
int var; |
| 495 |
template X(T) {} |
| 496 |
|
| 497 |
static assert( S.mangleof == "S6mangle9test12217FiZ1S"); |
| 498 |
static assert( bar.mangleof == "_D6mangle9test12217FiZ3barMFNaNbNiNfZv"); |
| 499 |
static assert( var.mangleof == "_D6mangle9test12217FiZ3vari"); |
| 500 |
static assert(X!int.mangleof == "6mangle9test12217FiZ"~tl!("8")~"__T1XTiZ"); |
| 501 |
} |
| 502 |
|
| 503 |
void test12217() {} |
| 504 |
|
| 505 |
/***************************************************/ |
| 506 |
// https://issues.dlang.org/show_bug.cgi?id=12231 |
| 507 |
|
| 508 |
void func12231a()() |
| 509 |
if (is(typeof({ |
| 510 |
class C {} |
| 511 |
static assert(C.mangleof == |
| 512 |
"C6mangle"~tl!("16")~"__U10func12231aZ"~id!("10func12231a","Qn")~"FZ17__lambda_L509_C15MFZ1C"); |
| 513 |
// ### L # |
| 514 |
}))) |
| 515 |
{} |
| 516 |
|
| 517 |
void func12231b()() |
| 518 |
if (is(typeof({ |
| 519 |
class C {} static assert(C.mangleof == |
| 520 |
"C6mangle"~tl!("16")~"__U10func12231bZ"~id!("10func12231b","Qn")~"FZ17__lambda_L518_C15MFZ1C"); |
| 521 |
// L__L L LL |
| 522 |
})) && |
| 523 |
is(typeof({ |
| 524 |
class C {} |
| 525 |
static assert(C.mangleof == |
| 526 |
"C6mangle"~tl!("16")~"__U10func12231bZ"~id!("10func12231b","Qn")~"FZ17__lambda_L523_C15MFZ1C"); |
| 527 |
// L__L L LL |
| 528 |
}))) |
| 529 |
{} |
| 530 |
|
| 531 |
void func12231c()() |
| 532 |
if (is(typeof({ |
| 533 |
class C {} |
| 534 |
static assert(C.mangleof == |
| 535 |
"C6mangle"~tl!("16")~"__U10func12231cZ"~id!("10func12231c","Qn")~"FZ17__lambda_L532_C15MFZ1C"); |
| 536 |
// L__L L LL |
| 537 |
}))) |
| 538 |
{ |
| 539 |
(){ |
| 540 |
class C {} |
| 541 |
static assert(C.mangleof == |
| 542 |
"C6mangle"~tl!("16")~"__T10func12231cZ"~id!("10func12231c","Qn")~"FZ16__lambda_L539_C5MFZ1C"); |
| 543 |
// L__L L LL |
| 544 |
}(); |
| 545 |
} |
| 546 |
|
| 547 |
void func12231c(X)() |
| 548 |
if (is(typeof({ |
| 549 |
class C {} |
| 550 |
static assert(C.mangleof == |
| 551 |
"C6mangle"~tl!("20")~"__U10func12231cTAyaZ"~id!("10func12231c","Qr")~"FZ17__lambda_L548_C15MFZ1C"); |
| 552 |
// L__L L___L LL |
| 553 |
}))) |
| 554 |
{ |
| 555 |
(){ |
| 556 |
class C {} |
| 557 |
static assert(C.mangleof == |
| 558 |
"C6mangle"~tl!("20")~"__T10func12231cTAyaZ"~id!("10func12231c","Qr")~"FZ16__lambda_L555_C5MFZ1C"); |
| 559 |
// L__L L___L LL |
| 560 |
}(); |
| 561 |
} |
| 562 |
|
| 563 |
void test12231() |
| 564 |
{ |
| 565 |
func12231a(); |
| 566 |
|
| 567 |
func12231b(); |
| 568 |
|
| 569 |
func12231c(); |
| 570 |
func12231c!string(); |
| 571 |
} |
| 572 |
|
| 573 |
/***************************************************/ |
| 574 |
|
| 575 |
class CC |
| 576 |
{ |
| 577 |
int* p; |
| 578 |
|
| 579 |
int* member() scope |
| 580 |
{ |
| 581 |
return p; |
| 582 |
} |
| 583 |
} |
| 584 |
|
| 585 |
static assert(CC.member.mangleof == "_D6mangle2CC6memberMFNlZPi"); |
| 586 |
|
| 587 |
/***************************************************/ |
| 588 |
|
| 589 |
void fooA(void delegate (scope void delegate()) dg) |
| 590 |
{ |
| 591 |
} |
| 592 |
void fooB(void delegate (void delegate()) scope dg) |
| 593 |
{ |
| 594 |
} |
| 595 |
|
| 596 |
//pragma(msg, fooA.mangleof); |
| 597 |
//pragma(msg, fooB.mangleof); |
| 598 |
static assert(typeof(fooA).mangleof != typeof(fooB).mangleof); |
| 599 |
|
| 600 |
|
| 601 |
/***************************************************/ |
| 602 |
|
| 603 |
@live int testLive() { return 42; } |
| 604 |
|
| 605 |
static assert(testLive.mangleof == "_D6mangle8testLiveFNmZi"); |
| 606 |
|
| 607 |
/***************************************************/ |
| 608 |
|
| 609 |
alias noreturn = typeof(*null); |
| 610 |
alias fpd = noreturn function(); |
| 611 |
int funcd(fpd); |
| 612 |
static assert(funcd.mangleof == "_D6mangle5funcdFPFZNnZi"); |
| 613 |
|
| 614 |
/***************************************************/ |
| 615 |
|
| 616 |
struct S21753 { void function() f1; } |
| 617 |
void fun21753(S21753 v)() {} |
| 618 |
alias fl21753 = (){}; |
| 619 |
static assert((fun21753!(S21753(fl21753))).mangleof == "_D6mangle__T8fun21753VSQv6S21753S1f_DQBj16" ~ fl21753.stringof ~ "MFNaNbNiNfZvZQChQp"); |
| 620 |
|
| 621 |
/***************************************************/ |
| 622 |
void main() |
| 623 |
{ |
| 624 |
test10077h(); |
| 625 |
test10077i(); |
| 626 |
test12044(); |
| 627 |
} |