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 int foo(Method method = Method.A)()
19 {
20     static assert(foo.mangleof == "_D8link6574"~tl!"28"~"__T3fooVE"~id!("8link6574","Qs")~"6Methodi0Z"~id!("3foo","Qs")~"FZi");
21     return 10 * foo!method();
22 }
23 int foo(Method method : Method.A)()
24 {
25     static assert(foo.mangleof == "_D8link6574"~tl!"29"~"__T3fooHVE"~id!("8link6574","Qt")~"6Methodi0Z"~id!("3foo","Qt")~"FZi");
26     return 2;
27 }
28 int foo(Method method : Method.B)()
29 {
30     static assert(0);
31     return 3;
32 }
33 
34 int bar(Method method = Method.B)()
35 {
36     static assert(bar.mangleof == "_D8link6574"~tl!"28"~"__T3barVE"~id!("8link6574","Qs")~"6Methodi1Z"~id!("3bar","Qs")~"FZi");
37     return 10 * bar!method();
38 }
39 int bar(Method method : Method.A)()
40 {
41     static assert(0);
42     return 2;
43 }
44 int bar(Method method : Method.B)()
45 {
46     static assert(bar.mangleof == "_D8link6574"~tl!"29"~"__T3barHVE"~id!("8link6574","Qt")~"6Methodi1Z"~id!("3bar","Qt")~"FZi");
47     return 3;
48 }
49 
main()50 void main()
51 {
52     assert(foo!() == 10 * 2);
53     assert(foo() == 10 * 2);
54 
55     assert(bar!() == 10 * 3);
56     assert(bar() == 10 * 3);
57 }
58