[Issue 14975] DMD refuses to inline even trivial struct constructors
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Aug 28 20:48:35 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14975
--- Comment #3 from thomas.bockman at 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);
}
--
More information about the Digitalmars-d-bugs
mailing list