http://d.puremagic.com/issues/show_bug.cgi?id=2434
Steven Schveighoffer <schvei...@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schvei...@yahoo.com Version|1.036 |D1 & D2 Summary|Compiler generates code |Need a way to add casts |that does not pass with -w |into array operations. |for some array operations | OS/Version|Windows |All Severity|normal |enhancement --- Comment #3 from Steven Schveighoffer <schvei...@yahoo.com> 2011-07-13 12:37:32 PDT --- hm... shouldn't the calculation follow the same rules as an individual operation? for example byte b; b = 1 / b; This has the same error message, so I would assume that an array operation must obey the same rules. The biggest issue here is, how does one create an expression which circumvents the requirement? In my above example, you can do: b = cast(byte)(1 / b); but this doesn't work: a[] = cast(byte)(1 / a[]); or a[] = cast(byte[])(1 / a[]); So essentially there is no way to insert a cast into the array expression. I think we almost need a new syntax for this (maybe cast[](byte)? ) I'm going to rename the bug (and adjust properties accordingly) because the code you wrote is *supposed* to give an error. The issue is that there's no way to cast out of it! Note the reason D2 does not give an error (with or without -w) on your original code is because of range propagation. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------