| 1 |
/* |
| 2 |
https://issues.dlang.org/show_bug.cgi?id=18385 |
| 3 |
|
| 4 |
TEST_OUTPUT: |
| 5 |
--- |
| 6 |
fail_compilation/fail2789.d(15): Error: function `fail2789.A2789.m()` conflicts with previous declaration at fail_compilation/fail2789.d(10) |
| 7 |
--- |
| 8 |
*/ |
| 9 |
#line 7 |
| 10 |
|
| 11 |
class A2789 |
| 12 |
{ |
| 13 |
int m() |
| 14 |
{ |
| 15 |
return 1; |
| 16 |
} |
| 17 |
|
| 18 |
float m() // conflict |
| 19 |
{ |
| 20 |
return 2.0; |
| 21 |
} |
| 22 |
|
| 23 |
float m() const // doen't conflict |
| 24 |
{ |
| 25 |
return 3.0; |
| 26 |
} |
| 27 |
|
| 28 |
static void m() // no conflict |
| 29 |
{ |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
/* |
| 34 |
TEST_OUTPUT: |
| 35 |
--- |
| 36 |
fail_compilation/fail2789.d(49): Error: function `fail2789.f4()` conflicts with previous declaration at fail_compilation/fail2789.d(48) |
| 37 |
fail_compilation/fail2789.d(55): Error: function `fail2789.f6()` conflicts with previous declaration at fail_compilation/fail2789.d(54) |
| 38 |
--- |
| 39 |
*/ |
| 40 |
|
| 41 |
|
| 42 |
void f1(); |
| 43 |
void f1() {} // ok |
| 44 |
|
| 45 |
void f2() {} |
| 46 |
void f2(); // ok |
| 47 |
|
| 48 |
void f3(); |
| 49 |
void f3(); // ok |
| 50 |
|
| 51 |
void f4() {} |
| 52 |
void f4() {} // conflict |
| 53 |
|
| 54 |
void f5() @safe {} |
| 55 |
void f5() @system {} // no conflict because of attribute based overloading in in extern(D) |
| 56 |
|
| 57 |
auto f6() { return 10; } // int() |
| 58 |
auto f6() { return ""; } // string(), conflict |
| 59 |
|
| 60 |
/* |
| 61 |
TEST_OUTPUT: |
| 62 |
--- |
| 63 |
fail_compilation/fail2789.d(67): Error: function `fail2789.f_ExternC1()` conflicts with previous declaration at fail_compilation/fail2789.d(66) |
| 64 |
fail_compilation/fail2789.d(70): Error: function `fail2789.f_ExternC2` cannot overload `extern(C)` function at fail_compilation/fail2789.d(69) |
| 65 |
fail_compilation/fail2789.d(73): Error: function `fail2789.f_ExternC3` cannot overload `extern(C)` function at fail_compilation/fail2789.d(72) |
| 66 |
--- |
| 67 |
*/ |
| 68 |
|
| 69 |
extern(C) void f_ExternC1() {} |
| 70 |
extern(C) void f_ExternC1() {} // conflict |
| 71 |
|
| 72 |
extern(C) void f_ExternC2() {} |
| 73 |
extern(C) void f_ExternC2(int) {} // conflict |
| 74 |
|
| 75 |
extern(C) void f_ExternC3(int) {} |
| 76 |
extern(C) void f_ExternC3() {} // conflict |
| 77 |
|
| 78 |
extern (D) void f_MixExtern1() {} |
| 79 |
extern (C) void f_MixExtern1() {} // no conflict because of different mangling |
| 80 |
|
| 81 |
extern (D) void f_MixExtern2(int) {} |
| 82 |
extern (C) void f_MixExtern2() {} // no error |
| 83 |
|
| 84 |
extern (C) void f_ExternC4(int sig); |
| 85 |
extern (C) void f_ExternC4(int sig) @nogc; // no error |
| 86 |
|
| 87 |
extern (C) void f_ExternC5(int sig) {} |
| 88 |
extern (C) void f_ExternC5(int sig) @nogc; // no error |
| 89 |
|
| 90 |
extern (C) void f_ExternC6(int sig); |
| 91 |
extern (C) void f_ExternC6(int sig) @nogc {} // no error |
| 92 |
|
| 93 |
/* |
| 94 |
TEST_OUTPUT: |
| 95 |
--- |
| 96 |
fail_compilation/fail2789.d(103): Error: function `fail2789.mul14147(const(int[]) left, const(int[]) right)` conflicts with previous declaration at fail_compilation/fail2789.d(99) |
| 97 |
--- |
| 98 |
*/ |
| 99 |
struct S14147(alias func) |
| 100 |
{ |
| 101 |
} |
| 102 |
pure auto mul14147(const int[] left, const int[] right) |
| 103 |
{ |
| 104 |
S14147!(a => a) s; |
| 105 |
} |
| 106 |
pure auto mul14147(const int[] left, const int[] right) |
| 107 |
{ |
| 108 |
S14147!(a => a) s; |
| 109 |
} |