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

Array operation return type #18820

Open
dlangBugzillaToGithub opened this issue Apr 25, 2014 · 3 comments
Open

Array operation return type #18820

dlangBugzillaToGithub opened this issue Apr 25, 2014 · 3 comments

Comments

@dlangBugzillaToGithub
Copy link

bearophile_hugs reported this on 2014-04-25T14:10:21Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=12648

CC List

  • Manu
  • yebblies

Description

I think both the following should compile:


int[1] foo1(int[1] a) {
    a[] += 10;
    return a;         // OK.
}
int[1] foo2(int[1] a) {
    return a[] += 10; // Error.
}
void main() {}


DMD 2.066alpha gives:

test.d(6,16): Error: cannot implicitly convert expression (_arrayExpSliceAddass_i(a[], 10)) of type int[] to int[1]
@dlangBugzillaToGithub
Copy link
Author

k.hara.pg commented on 2014-09-21T03:52:51Z

*** Issue 12770 has been marked as a duplicate of this issue. ***

@dlangBugzillaToGithub
Copy link
Author

bearophile_hugs commented on 2014-09-21T09:41:09Z

(In reply to Kenji Hara from comment #1)
> *** Issue 12770 has been marked as a duplicate of this issue. ***

I think the good way to solve this bug and others (and to improve D language usability in other ways) is with the enhancement of Issue 13228

@dlangBugzillaToGithub
Copy link
Author

yebblies commented on 2014-11-04T08:26:33Z

(In reply to bearophile_hugs from comment #2)
> 
> I think the good way to solve this bug and others (and to improve D language
> usability in other ways) is with the enhancement of Issue 13228

I agree.

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

1 participant