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

Possible inconsistency in array literals implicit cast #17638

Open
dlangBugzillaToGithub opened this issue Feb 6, 2014 · 0 comments
Open

Possible inconsistency in array literals implicit cast #17638

dlangBugzillaToGithub opened this issue Feb 6, 2014 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

bearophile_hugs reported this on 2014-02-06T16:08:47Z

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

Description

I am not sure, but perhaps this shows an inconsistency worth fixing:


long[] foo() {
    return [1];         // OK
}
void main() {
    long[] a;
    auto b1 = a ~ 0;   // OK
    auto b2 = a ~ [0]; // Error
    auto c1 = 0 ~ a;   // OK
    auto c2 = [0] ~ a; // Error
}


dmd 2.065beta2 gives:

test.d(7): Error: incompatible types for ((a) ~ ([0])): 'long[]' and 'int[]'
test.d(9): Error: incompatible types for (([0]) ~ (a)): 'int[]' and 'long[]'
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