GDC fails to inline some trivial functions (like array.empty) in certain cases.
The simplest testcase (that i can think of) that still exhibits the problem:
import std.array, std.algorithm;
immutable a = [1];
int main() {
return a.filter!"true"().empty;
}
This gets compiled to:
<_Dmain>:
sub $0x18,%rsp
mov $0x1,%edi
mov $0x65d968,%esi
callq <pure nothrow @property @safe bool
std.array.empty!(int).empty(const(int[]))>
add $0x18,%rsp
movzbl %al,%eax
retq
Originally reported on ML @
http://forum.dlang.org/post/mailman.75.1396605155.19942.d.gnu@puremagic.com ;
some more info in that thread.
Could be related to http://bugzilla.gdcproject.org/show_bug.cgi?id=120 ,
which I thought was the same bug, but it turns out that the testcase in #120
does *not* fail here.