[Issue 2434] New: Compiler generates code that does not pass with -w for some array operations
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 28 16:11:28 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2434
Summary: Compiler generates code that does not pass with -w for
some array operations
Product: D
Version: 1.036
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: jarrett.billingsley at gmail.com
T[] a = [1, 2, 3, 4, 5];
a[] = 1 op a;
Replace T with byte, ubyte, short, or ushort. Replace op with / or %. For
example:
byte[] a = [1, 2, 3, 4, 5];
a[] = 1 / a;
All possible combinations give errors like this when -w is enabled:
warning - Error: implicit conversion of expression (cast(int)c0 /
cast(int)(p1[p])) of type int to byte can cause loss of data
The c0, p1, and p variables are what the compiler uses for internal names when
converting array operations into code, so this is an error in the generated
code.
Similar things happen if you have something like:
T[] b = [1, 2, 3, 4, 5];
a[] = b[] op a[];
--
More information about the Digitalmars-d-bugs
mailing list