[Issue 8722] New: foreach triggers a floating point exception with multidimensional array of a dimension equal to 0
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 25 01:55:45 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8722
Summary: foreach triggers a floating point exception with
multidimensional array of a dimension equal to 0
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: blooh_ at hotmail.com
--- Comment #0 from Christopher Crouzet <blooh_ at hotmail.com> 2012-09-25 01:56:23 PDT ---
The code below triggers a floating point exception, not sure if it's too be
expected?
// ------------------------------
import std.stdio;
import std.traits;
void whatever( T )( in ref T array )
{
static if ( isArray!( T ) )
foreach ( element; array )
whatever( element );
}
void main()
{
int[0][2][3] array;
whatever( array );
}
// ------------------------------
If changing the loop to
// ------------------------------
foreach ( i; 0 .. array.length )
whatever( array[i] );
// ------------------------------
it works fine.
Also changing the array type to int[0][2] ie. works as well.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list