Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning value transitively through assignment doesn't work #629

Closed
aubade opened this issue Jun 11, 2014 · 4 comments
Closed

Returning value transitively through assignment doesn't work #629

aubade opened this issue Jun 11, 2014 · 4 comments

Comments

@aubade
Copy link

aubade commented Jun 11, 2014

The following code compiles in dmd and gdc, but not the current ldc beta, on Linux x86-64:

struct rectarray(T) {
    T[] data;
    size_t width;

    auto ref T opIndexAssign (ref T value, size_t col, size_t row) {
        return data[row * width + col] = value;
    }
    auto ref T opIndexAssign (T value, size_t col, size_t row) {
        return data[row * width + col] = value;
    }
}

void main() {
    rectarray!int wrap;
}

instead, it gives the error:

test.d(6): Error: this.data[row * this.width + col] = value is not an lvalue
@redstar
Copy link
Member

redstar commented Jun 12, 2014

Does not compile with dmd 2.064.2. It's a bug fixed in a later version.

@aubade
Copy link
Author

aubade commented Jun 12, 2014

Oh, whoops! Sorry, I assumed that since it claimed the same dmd version, the current gdc release would manifest problems the same way.

@redstar
Copy link
Member

redstar commented Jun 12, 2014

The current gdc release should also be based on 2.064.2. A pull request for gdc based on 2.065 was created yesterday. Don't know why it works for you.
(BTW: If you compile ldc from source, then you can use the merge-2.065 branch. This should contain the fixed frontend.)

@dnadlinger
Copy link
Member

Now works on Git master.

redstar pushed a commit that referenced this issue Sep 27, 2014
Add core.sys.posix.fcntl.O_* flag definitions for ARM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants