Bug 7705 – lambda syntax doesn't allow some valid signatures

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-13T20:42:00Z
Last change time
2012-03-22T01:42:04Z
Keywords
ice, pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2012-03-13T20:42:46Z
Following code should work as expected. void main() { // lambda has a qualified parameter that needs type inference void foo1(void delegate(ref int ) dg){ int x=10; dg(x); } foo1((ref x){ assert(x == 10); }); // test.d(4): Error: undefined identifier x // Assertion failure: 'typen->deco' on line 1690 in file 'cast.c' // lambda has C style variadic void foo2(void delegate(int, ...) dg){ dg(20, 3.14); } foo2((x,...){ assert(x == 20); }); // OK // lambda has D style type safe variadic void foo3(void delegate(int[]...) dg){ dg(1, 2, 3); } foo3((x ...){ assert(x == [1,2,3]); }); // test.d(16): Error: undefined identifier x // Assertion failure: 'typen->deco' on line 1690 in file 'cast.c' }
Comment #1 by k.hara.pg — 2012-03-13T20:48:27Z
Comment #2 by github-bugzilla — 2012-03-14T01:24:57Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/dc89c64a8739d3379ccca0088deaead096ac0332 Merge pull request #809 from 9rnsr/fix_funclit Issue 7705 - lambda syntax doesn't allow some valid signatures
Comment #3 by timon.gehr — 2012-03-22T01:42:04Z
*** Issue 7297 has been marked as a duplicate of this issue. ***