www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13251] New: std.array.split gives different results with

https://issues.dlang.org/show_bug.cgi?id=13251

          Issue ID: 13251
           Summary: std.array.split gives different results with specific
                    compiler flags
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: olaa81 gmail.com

Using dmd 2.066.0-rc1

Test with the following code:
-- splittest.d --
import std.stdio : writeln;
import std.array : split;

void main()
{
  writeln("one,two,three".split(","));
}
 -- splittest.d --

Compiled with 'rdmd splittest.d' outputs ["one", "two", "three"] as expected.
Compiled with 'rdmd -inline -O splittest.d' outputs ["one,two,three"], an array
with one element instead of three.

It is the combination of the -inline and -O flags that causes the issue, on
their own it works.

Works fine in dmd 2.065.

--
Aug 03 2014