[Issue 13244] Wrong code with -inline and foreach/map/all

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Nov 4 14:26:41 PST 2015


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

Ola Østtveit <olaa81 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #9 from Ola Østtveit <olaa81 at gmail.com> ---
I'm getting this again with dmd 2.069.

With the files below, running rdmd -g -inline main.d I get:

object.Error@(0): Access Violation
----------------
0x00821014
0x0040221A in
D3std5array135__T5arrayTS3std9algorithm9iteration87__T9MapResultS67_D11failsinline11FailsInline7146BC2938FC1915EBA515935C5C811A
0x0040247F in void failsinline.FailsInline.failsinline() at
E:\source\dice\failsinline.d(9)
0x00402027 in _Dmain at E:\source\dice\main.d(7)
0x00402BF7 in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
0x00402BBB in void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll()
0x00402ABC in _d_run_main
0x004023F0 in main at E:\source\dice\main.d(7)
0x0041D0F5 in mainCRTStartup
0x77693744 in BaseThreadInitThunk
0x77BBA064 in RtlSetCurrentTransaction
0x77BBA02F in RtlSetCurrentTransaction

When removing the std.algorithm import from main.d or compiling without -inline
it works fine.

-- main.d --
import std.algorithm;
import failsinline;

void main()
{
  auto fail = new FailsInline();
  fail.failsinline();
}
-- main.d --

-- failsinline.d --
import std.algorithm : map;
import std.array : array;

class FailsInline
{
  void failsinline()
  {
    auto transform = (int i) => i;
    [0].map!transform.array;
  }
}
-- failsinline.d --

--


More information about the Digitalmars-d-bugs mailing list