| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
---- |
| 4 |
fail_compilation/fail58.d(28): Error: function `SomeFunc` is not callable using argument types `(string, int)` |
| 5 |
fail_compilation/fail58.d(28): cannot pass argument `"123"` of type `string` to parameter `dchar[] pText` |
| 6 |
fail_compilation/fail58.d(14): `fail58.SomeFunc(dchar[] pText, out int pStopPosn)` declared here |
| 7 |
fail_compilation/fail58.d(32): Error: function `SomeFunc` is not callable using argument types `(string, int)` |
| 8 |
fail_compilation/fail58.d(32): cannot pass argument `""` of type `string` to parameter `dchar[] pText` |
| 9 |
fail_compilation/fail58.d(14): `fail58.SomeFunc(dchar[] pText, out int pStopPosn)` declared here |
| 10 |
---- |
| 11 |
*/ |
| 12 |
debug import std.stdio; |
| 13 |
const int anything = -1000; // Line #2 |
| 14 |
dchar[] SomeFunc( dchar[] pText, out int pStopPosn) |
| 15 |
{ |
| 16 |
if (pText.length == 0) |
| 17 |
pStopPosn = 0; |
| 18 |
else |
| 19 |
pStopPosn = -1; |
| 20 |
debug writefln("DEBUG: using '%s' we get %d", pText, pStopPosn); |
| 21 |
return pText.dup; |
| 22 |
} |
| 23 |
|
| 24 |
int main(char[][] pArgs) |
| 25 |
{ |
| 26 |
int sp; |
| 27 |
|
| 28 |
SomeFunc("123", sp); |
| 29 |
debug writefln("DEBUG: got %d", sp); |
| 30 |
assert(sp == -1); |
| 31 |
|
| 32 |
SomeFunc("", sp); |
| 33 |
// if (sp != 0){} // Line #22 |
| 34 |
debug writefln("DEBUG: got %d", sp); |
| 35 |
assert(sp == -1); |
| 36 |
return 0; |
| 37 |
} |