D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7705 - lambda syntax doesn't allow some valid signatures
Summary: lambda syntax doesn't allow some valid signatures
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: ice, pull, rejects-valid
: 7297 (view as issue list)
Depends on:
Blocks:
 
Reported: 2012-03-13 20:42 UTC by Kenji Hara
Modified: 2012-03-22 01:42 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2012-03-13 20:42:46 UTC
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 2 github-bugzilla 2012-03-14 01:24:57 UTC
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 timon.gehr 2012-03-22 01:42:04 UTC
*** Issue 7297 has been marked as a duplicate of this issue. ***