[Issue 19783] New: Fail to emplace struct with betterC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 31 21:10:51 UTC 2019


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

          Issue ID: 19783
           Summary: Fail to emplace struct with betterC
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: kuettler at gmail.com

When trying to emplace a struct with dmd -betterC, a linker reports a missing
symbol. The program

import core.stdc.stdlib;
import std.conv;

struct TestStruct
{
  int i;
}

extern (C)
int main(size_t argc, char** argv)
{
  enum size = TestStruct.sizeof;
  auto buf = malloc(size);
  scope(exit) free(buf);

  auto r = emplace!TestStruct(buf[0 .. size]);

  return 0;
}

Leads to

betterc_2.o: In function
`_D3std4conv__T7emplaceTS9betterc_210TestStructZQBhFNaNbNiAvZPQBm':
betterc_2.d:(.text._D3std4conv__T7emplaceTS9betterc_210TestStructZQBhFNaNbNiAvZPQBm[_D3std4conv__T7emplaceTS9betterc_210TestStructZQBhFNaNbNiAvZPQBm]+0x24):
undefined reference to `_D3std4conv16testEmplaceChunkFNaNbNiNfAvmmZv'

Without -betterC it works just fine.

--


More information about the Digitalmars-d-bugs mailing list