Poll: what should this program do?
Paul Backus
snarwin at gmail.com
Wed Mar 19 03:40:28 UTC 2025
Here's a weird little program that came up in a recent Discord
discussion:
template fun(T)
{
string fun(T) => fun("hi");
string fun(string) => "inner";
}
string fun(string) => "outer";
void main()
{
import std.stdio;
writeln(fun(123));
}
**What SHOULD this program do?**
1. Print "inner".
2. Print "outer".
3. It shouldn't compile.
**What do you think it ACTUALLY does?**
1. Print "inner".
2. Print "outer".
3. It doesn't compile.
More information about the Digitalmars-d
mailing list