[Issue 7917] -inline option fails for complex expressions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 16 04:40:18 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7917



--- Comment #2 from Russel Winder <russel at winder.org.uk> 2012-04-16 04:41:09 PDT ---
Given the code:

import std.algorithm ;
import std.range ;
import std.stdio ;
import std.typecons ;

double partialSum ( immutable Tuple ! ( int , int , double ) data ) { 
  return 1.0 ;
}

void execute ( immutable int numberOfTasks ) {
  immutable n = 1000000000 ;
  immutable delta = 1.0 / n ;
  immutable sliceSize = n / numberOfTasks ;
  immutable pi = reduce ! ( ( a , b ) => a + b ) ( 0.0 , map ! ( partialSum ) (
    map ! ( i => tuple ( i , cast ( int ) sliceSize , cast ( double ) delta ) )
( iota ( numberOfTasks ) ) ) ) ;
}

int main ( immutable string[] args ) {
  execute ( 1 ) ;
  return 0 ;
}


The problem lies with the cast of sliceSice.  Change the parameter to a literal
and it goes away.  Change the definition of sliceSize and it goes away.

-- 
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