[Issue 22374] New: [REG 2.093] 'import std;' with -checkaction=context causes link error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 10 03:21:03 UTC 2021


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

          Issue ID: 22374
           Summary: [REG 2.093] 'import std;' with -checkaction=context
                    causes link error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: snarwin+bugzilla at gmail.com

As of DMD 2.097.2, compiling the following program with the flag
`-checkaction=context` results in a linker error.

---
import std;

void main()
{
    assert(0);
}
---

The error is:

---
/usr/bin/ld: bug.o: in function `_Dmain':
bug.d:(.text._Dmain[_Dmain]+0x33): undefined reference to
`_D4core8internal7dassert__T14_d_assert_failTiZQtFNaNbNiNfMxAyaxiZAya'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
---

Demangled:

---
/usr/bin/ld: bug.o: in function `_Dmain':
bug.d:(.text._Dmain[_Dmain]+0x33): undefined reference to `pure nothrow @nogc
@safe immutable(char)[]
core.internal.dassert._d_assert_fail!(int)._d_assert_fail(scope
const(immutable(char)[]), const(int))'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
---

Removing the line `import std;`, or changing it to import a different module
such as `std.range`, causes the program to compile and link successfully.

According to run.dlang.io, this is a regression introduced in DMD 2.093.

--


More information about the Digitalmars-d-bugs mailing list