[Issue 10963] Wrong code with aliased function referencing closure variable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 23 05:30:25 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=10963


Peter Alexander <peter.alexander.au at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |peter.alexander.au at gmail.co
                   |                            |m
          Component|Phobos                      |DMD
            Summary|filter.save in map changes  |Wrong code with aliased
                   |the behavior of filter      |function referencing
                   |                            |closure variable


--- Comment #1 from Peter Alexander <peter.alexander.au at gmail.com> 2014-02-23 05:30:19 PST ---
This is a code gen bug. I have minimized it as much as I can:

http://dpaste.dzfl.pl/e2e878490438

-------------------------------------
void test(int[] a)
{
    assert(a.length == 1);
}

struct A(alias p)
{
    this(int a) { p(); }
    A foo() { return A(0); }
}

void main()
{
    int[] a = [0];
    () { A!(() => test(a))(0).foo(); }();
}
-------------------------------------

The assert still fires, despite the fact that test is only ever called with
'main.a', which never changes.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list