[Issue 19783] Fail to emplace struct with betterC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 23 09:51:56 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=19783

--- Comment #1 from Tomáš Chaloupka <chalucha at gmail.com> ---
Similar problem when using core.lifetime:

```D
import core.lifetime;
import core.stdc.stdlib;

struct Foo { int bar; }

extern(C) void main()
{
        auto pf = malloc(Foo.sizeof)[0..Foo.sizeof].emplace!Foo(42);
        assert(pf.bar == 42);
}
```

With: dmd -g -debug -betterC -ofbc bc.d

Leads to:
/usr/bin/ld: bc.o: in function
`_D4core8lifetime__T7emplaceTS2bc3FooTiZQuFNaNbNiAviZPQz':
/home/tomas/dlang/dmd-2.094.2/linux/bin64/../../src/druntime/import/core/lifetime.d:284:
undefined reference to `_D4core8lifetime16testEmplaceChunkFNaNbNiNfAvmmZv'

--


More information about the Digitalmars-d-bugs mailing list