[Issue 12091] New: Possible inconsistency in array literals implicit cast
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 6 16:08:50 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12091
Summary: Possible inconsistency in array literals implicit cast
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2014-02-06 16:08:47 PST ---
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[]'
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list