Bug 11125 – UFCS instantiation of template causes template constraint to be skipped
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-25T12:55:00Z
Last change time
2013-09-27T00:51:14Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2013-09-25T12:55:29Z
-----
import std.traits;
template filter(alias predfun)
if (is(ReturnType!predfun == bool))
{
static assert(is(ReturnType!predfun == bool));
auto filter(Range)(Range r) { }
}
void main()
{
filter!((int a) => a + 1)([1]); // fails in constraint
[1].filter!((int a) => a + 1); // fails internally in static assert!
}
-----
The bug seems to be fixed in 2.064 git-head, but I can't recall if I've seen it filed as a bug. Is this a duplicate? We should make sure this test-case gets added if the bug wasn't fixed on purpose.
Comment #1 by k.hara.pg — 2013-09-25T19:50:48Z
(In reply to comment #0)
> The bug seems to be fixed in 2.064 git-head, but I can't recall if I've seen it
> filed as a bug. Is this a duplicate? We should make sure this test-case gets
> added if the bug wasn't fixed on purpose.
As far as I know, duplicated issue had not filed in bugzilla.
But, from bisecting, I found the bug was fixed in the PR.
https://github.com/D-Programming-Language/dmd/pull/2337
In there, I had also intended *normalizing* the evaluation order of template instantiations. So I can say that the bugfix was _half_ intended.
To complete the fix, I opened a PR for adding a test case.
https://github.com/D-Programming-Language/dmd/pull/2589
Thank you.