Skip to content

Conversation

@kinke
Copy link
Member

@kinke kinke commented Apr 23, 2015

Fixes runnable/testassign.d:

void test12211()
{
    int a = 0;
    void foo(ref int x)
    {
        assert(x == 10);
        assert(&x == &a);
        x = 3;
    }
    foo(a = 10);
    assert(a == 3);
    foo(a += 7);
    assert(a == 3);
...
}

Previously, in foo(a += 7) a new lvalue based on the rvalue binAssign result was passed to foo() instead of the nested lvalue a.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated, but caused a segfault while debugging with -vv. DeclarationExp::type may be null for current front-end (see https://github.com/ldc-developers/ldc/blob/merge-2.067/dmd2/expression.c#L1556).

redstar added a commit that referenced this pull request Apr 24, 2015
Enable passing binAssign expressions as ref/out arguments.
@redstar redstar merged commit ae7ab29 into ldc-developers:merge-2.067 Apr 24, 2015
@kinke kinke deleted the binAssignByref branch August 24, 2017 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants