Comment # 3
on bug 140
from Johannes Pfau
Reduced:
test.d
----------------------------------------------------
import xtd.array;
int main()
{
void[] a = [];
return (FilterResult!(void[])(a)).empty;
}
struct FilterResult(Range)
{
Range _input;
@property empty() { return xtd.array.empty(_input); }
}
----------------------------------------------------
xtd/array.d
----------------------------------------------------
import gcc.attribute;
@attribute("forceinline") @property empty(T)(in T[] a)
{
return !a.length;
}
----------------------------------------------------
gdc test.d -finline
----------------------------------------------------
test.d: In member function 'empty':
xtd/array.d:3: error: inlining failed in call to always_inline 'empty':
mismatched arguments
test.d:14: error: called from here
----------------------------------------------------
Merging array.d/test.d leads to a different error:
test.d
----------------------------------------------------
import gcc.attribute;
@attribute("forceinline") @property empty2(T)(in T[] a)
{
return !a.length;
}
int main()
{
void[] a = [];
return (FilterResult!(void[])(a)).empty;
}
struct FilterResult(Range)
{
Range _input;
@property empty() { return empty2(_input); }
}
----------------------------------------------------
gdc test.d -finline
----------------------------------------------------
cc1d: /build/gdc/src/gcc-4.9.0/gcc/d/dfrontend/interpret.c:676: void
FuncDeclaration::ctfeCompile(): Assertion `semanticRun == PASSsemantic3done'
failed.
test.d: In member function 'empty':
test.d:18: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
----------------------------------------------------
This error vanishes if the forceinline attribute is removed.