D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12648 - Array operation return type
Summary: Array operation return type
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
: 12770 (view as issue list)
Depends on:
Blocks:
 
Reported: 2014-04-25 14:10 UTC by bearophile_hugs
Modified: 2024-12-13 18:20 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 bearophile_hugs 2014-04-25 14:10:21 UTC
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]
Comment 1 Kenji Hara 2014-09-21 03:52:51 UTC
*** Issue 12770 has been marked as a duplicate of this issue. ***
Comment 2 bearophile_hugs 2014-09-21 09:41:09 UTC
(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
Comment 3 yebblies 2014-11-04 08:26:33 UTC
(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.
Comment 4 dlangBugzillaToGithub 2024-12-13 18:20:06 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18820

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB