[Issue 24282] Error in the code is not detected by the compiler and only fails at the linking stage
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 15 10:27:49 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24282
Dennis <dkorpel at live.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dkorpel at live.nl
--- Comment #1 from Dennis <dkorpel at live.nl> ---
Reduced to remove imports:
```D
template map(fun...)
{
auto map(Range)(Range r)
{
alias RE = ElementType!Range;
alias _fun = unaryFun!fun;
assert(!is(typeof(_fun(RE.init)) ));
MapResult!(_fun, Range)(r);
}
}
struct MapResult(alias fun, Range)
{
Range input;
this(Range range)
{
}
void front()
{
fun(input.front);
}
}
template unaryFun(alias fun)
{
alias unaryFun = fun;
}
template ElementType(R)
{
static if (is(typeof(R.init.front) T))
alias ElementType = T;
}
string front(string[] s)
{
return "";
}
int dummyhash(string s)
{
return 0;
}
void main()
{
auto input = ["a", "b"];
input.map!(s => s.map!dummyhash);
}
```
--
More information about the Digitalmars-d-bugs
mailing list