Thread overview
[Issue 14975] DMD refuses to inline even trivial struct constructors
Aug 29, 2015
Walter Bright
Sep 03, 2015
Walter Bright
Sep 03, 2015
Walter Bright
August 29, 2015
https://issues.dlang.org/show_bug.cgi?id=14975

--- Comment #1 from thomas.bockman@gmail.com ---
I have confirmed this issue affects 32-bit x86 Linux, as well.

--
August 29, 2015
https://issues.dlang.org/show_bug.cgi?id=14975

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |performance
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
A more complete example would be appreciated. Sometimes, it is something else causing the problem.

--
August 29, 2015
https://issues.dlang.org/show_bug.cgi?id=14975

--- Comment #3 from thomas.bockman@gmail.com ---
(In reply to Walter Bright from comment #2)
> A more complete example would be appreciated. Sometimes, it is something else causing the problem.

More complete in what sense?

>From my experimentation, this code will fail to compile with DMD in release
mode regardless of the context, but I can slap a main() function on it and make it a complete program, if you want:


module testd2;

import std.stdio;

struct foo {
    int bar;

    // Error: constructor testd2.foo.this cannot inline function
    pragma(inline, true) this(int bar) {
        this.bar = bar;
    }
}

void main(string[] args) {
    foo baz = 1;
    writeln(baz.bar);
}

--
September 03, 2015
https://issues.dlang.org/show_bug.cgi?id=14975

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=10286

--
September 03, 2015
https://issues.dlang.org/show_bug.cgi?id=14975

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
https://github.com/D-Programming-Language/dmd/pull/5033

--
September 04, 2015
https://issues.dlang.org/show_bug.cgi?id=14975

github-bugzilla@puremagic.com changed:

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

--
September 04, 2015
https://issues.dlang.org/show_bug.cgi?id=14975

--- Comment #5 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/545572134f613433f0efe3aaa247b3f401a02aa9 fix Issue 14975 - DMD refuses to inline even trivial struct constructors

https://github.com/D-Programming-Language/dmd/commit/68650c1df4608a10be47e5cfe0610babe7bd2f47 Merge pull request #5033 from WalterBright/fix14975

fix Issue 14975 - DMD refuses to inline even trivial struct constructors

--
September 05, 2015
https://issues.dlang.org/show_bug.cgi?id=14975

--- Comment #6 from thomas.bockman@gmail.com ---
I have tested, and PR #5033 does indeed fix this issue for me both in my simple test case, and also in the CheckedInt code where I originally discovered it. Thanks.

--