← Back to index
|
Original Bugzilla link
Bug 15564 – Bogus non local error messages
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-01-13T23:22:49Z
Last change time
2020-07-08T11:09:13Z
Assigned to
No Owner
Creator
deadalnix
Comments
Comment #0
by deadalnix — 2016-01-13T23:22:49Z
src/main.d(22): Error: template instance query!(function Inv(h) { ubyte[32] stop; h.send(GetBlocks(60002, [], stop)); return h.receive!Inv(); } , ) cannot use local '__funcliteral1' as parameter to non-global template query(alias f, T...)(T args) That's a function.
Comment #1
by deadalnix — 2016-01-13T23:23:49Z
The query method : auto query(alias f, T...)(T args) shared { auto s = acquireSocket(); scope(exit) releaseSocket(s); return f(Host(config, s), args); }
Comment #2
by code — 2016-01-18T17:38:45Z
Is this a regression? Does it affect any function literal?
Comment #3
by deadalnix — 2016-01-18T17:49:02Z
All function literals. It is also in the release so no regression, but it is a major blocker :)
Comment #4
by code — 2016-01-20T10:57:58Z
cat > bug.d << CODE struct Foo { void foo(alias f)() { f(2); } } void test() { Foo foo; foo.foo!(function(int a) => 2 * a)(); // works w/ function foo.foo!(function(a) => 2 * a)(); // doesn't work w/ function template } CODE dmd -c bug ---- bug.d(13): Error: template instance foo!(function (a) => 2 * a) cannot use local '__funcliteral1' as parameter to non-global template foo(alias f)() ---- This was already not possible in 2.066.1.
Comment #5
by simen.kjaras — 2020-07-08T11:09:13Z
The underlying issue here seems to be issue 5710, which is fixed.