[Bug 140] Inlining certain trivial function fails
via D.gnu
d.gnu at puremagic.com
Sat Jul 12 16:06:05 PDT 2014
http://bugzilla.gdcproject.org/show_bug.cgi?id=140
--- Comment #3 from Johannes Pfau <johannespfau at gmail.com> ---
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.
--
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20140712/f563549b/attachment.html>
More information about the D.gnu
mailing list