[Issue 9906] New: filter of static opCall
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 8 16:59:43 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9906
Summary: filter of static opCall
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-04-08 16:59:42 PDT ---
import std.stdio: writeln;
import std.algorithm: map, filter;
struct Seen {
static bool[int] set;
static bool opCall(int n) {
auto result = !!(n in set);
set[n] = true;
return result;
}
}
void main() {
auto data = [1, 5, 1, 3, 2, 1];
data.filter!(i => i.Seen).writeln; // OK.
data.map!Seen.writeln; // OK.
data.filter!Seen.writeln; // Error
}
DMD 2.063alpha gives:
temp.d(18): Error: template instance filter!(Seen) does not match template
declaration filter(alias pred) if (is(typeof(unaryFun!(pred))))
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list