www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23806] New: [REG 2.099.0] Link error with -betterC

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

          Issue ID: 23806
           Summary: [REG 2.099.0] Link error with -betterC
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zan77137 nifty.com

After the dmd-2.099.0, the following code causes a link error when built with
the -betterC compile option:
------------------
struct Foo
{
        ~this(){}
}
struct Bar
{
        this(ref Bar){}
}
struct Data
{
        Foo[2] _foo;
        Bar    _bar;
}
extern (C) void main()
{
        Data pool;
}
------------------

(dmd-2.099.0)dev cc4fa74d49d1:~/work$ dmd -betterC main.d
main.o:main.d:function
_D4core8internal5array12construction__T12_d_arrayctorHTANgS4main3FooTNgQnZQBjFNeNkMQBcMQBgPaZ27enforceRawArraysConformableMFNaNbNiNexAaxmxAvxQdZv:
error: undefined reference to
'_D4core8internal4util5array31enforceRawArraysConformableNogcFNbNfxAaxmxAvxQdxbZv'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1

This error does not occur before dmd-2.098.1 and in ldc-1.32.0

--
Mar 23 2023