Compiling
```
import core.bitop;
int foo(ulong x)
{
return bsr(x);
}
```
with `dmd -c -m32 -inline -wi" produces:
/dlang/dmd-beta/linux/bin64/../../src/druntime/import/core/bitop.d(45): Warning: cannot inline function `core.bitop.Split64.this`
The assembly shows that the ctor is indeed not inlined.
Comment #1 by maxhaton — 2023-03-12T23:53:09Z
Part of the wtf is warning on inline failure by default.
dmd's IR seems to make some kind of inlining basically impossible in practice. The transformation is mathematically possible but has not been implemented (for such a fundamental concept as inlining)
Comment #2 by r.sagitario — 2023-03-13T06:20:39Z
Something changed about the `__ctfe` branch in
```
union Split64
{
ulong u64;
uint lo;
pragma(inline, true)
this(ulong u64)
{
if (__ctfe)
lo = cast(uint) u64;
else
this.u64 = u64;
}
}
int foo(ulong v)
{
const sv = Split64(v);
return (sv.lo == 0);
}
```
If you replace `__ctfe` with `false` the wwarning disappears.
Comment #3 by robert.schadek — 2024-12-13T19:27:44Z