| 1 |
// PERMUTE_ARGS: |
| 2 |
// EXTRA_FILES: imports/testmangle.d |
| 3 |
/* |
| 4 |
TEST_OUTPUT: |
| 5 |
--- |
| 6 |
_D7imports10testmangle12detectMangleFPSQBlQBg6DetectZQq |
| 7 |
_D7imports10testmangle__T10DetectTmplTiZQpFNaNbNiNfZv |
| 8 |
true |
| 9 |
false |
| 10 |
--- |
| 11 |
*/ |
| 12 |
module link6574; |
| 13 |
|
| 14 |
import imports.testmangle; |
| 15 |
|
| 16 |
enum Method { A, B, } |
| 17 |
|
| 18 |
@safe @nogc pure nothrow: |
| 19 |
|
| 20 |
enum FZi = "FNaNbNiNfZi"; // pure nothrow @nogc @safe |
| 21 |
|
| 22 |
int foo(Method method = Method.A)() |
| 23 |
{ |
| 24 |
static assert(foo.mangleof == "_D8link6574"~tl!"28"~"__T3fooVE"~id!("8link6574","Qs")~"6Methodi0Z"~id!("3foo","Qs")~FZi); |
| 25 |
return 10 * foo!method(); |
| 26 |
} |
| 27 |
int foo(Method method : Method.A)() |
| 28 |
{ |
| 29 |
static assert(foo.mangleof == "_D8link6574"~tl!"29"~"__T3fooHVE"~id!("8link6574","Qt")~"6Methodi0Z"~id!("3foo","Qt")~FZi); |
| 30 |
return 2; |
| 31 |
} |
| 32 |
int foo(Method method : Method.B)() |
| 33 |
{ |
| 34 |
static assert(0); |
| 35 |
return 3; |
| 36 |
} |
| 37 |
|
| 38 |
int bar(Method method = Method.B)() |
| 39 |
{ |
| 40 |
static assert(bar.mangleof == "_D8link6574"~tl!"28"~"__T3barVE"~id!("8link6574","Qs")~"6Methodi1Z"~id!("3bar","Qs")~FZi); |
| 41 |
return 10 * bar!method(); |
| 42 |
} |
| 43 |
int bar(Method method : Method.A)() |
| 44 |
{ |
| 45 |
static assert(0); |
| 46 |
return 2; |
| 47 |
} |
| 48 |
int bar(Method method : Method.B)() |
| 49 |
{ |
| 50 |
static assert(bar.mangleof == "_D8link6574"~tl!"29"~"__T3barHVE"~id!("8link6574","Qt")~"6Methodi1Z"~id!("3bar","Qt")~FZi); |
| 51 |
return 3; |
| 52 |
} |
| 53 |
|
| 54 |
void main() |
| 55 |
{ |
| 56 |
assert(foo!() == 10 * 2); |
| 57 |
assert(foo() == 10 * 2); |
| 58 |
|
| 59 |
assert(bar!() == 10 * 3); |
| 60 |
assert(bar() == 10 * 3); |
| 61 |
} |