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: nob...@puremagic.com
        ReportedBy: blo...@hotmail.com


--- Comment #0 from Christopher Crouzet <blo...@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: -------

Reply via email to