www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23255] New: undefined reference to

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

          Issue ID: 23255
           Summary: undefined reference to
                    `_D4core8internal7switch___T14__switch_errorZQrFNaNbNi
                    NfAyamZv'
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: puneet coverify.org

With latest DMD:

$ dmd -release -shared -fPIC foo.d -oflibesdl-ldc-shared.so
$ dmd test.d libesdl-ldc-shared.so
/usr/bin/ld: test.o: in function
`_D3std3uni__T21genericDecodeGraphemeVbi0Z__TQBfTAxwZQBnFNaNbNiNfKQrZv':
test.d:(.text._D3std3uni__T21genericDecodeGraphemeVbi0Z__TQBfTAxwZQBnFNaNbNiNfKQrZv[_D3std3uni__T21genericDecodeGraphemeVbi0Z__TQBfTAxwZQBnFNaNbNiNfKQrZv]+0x3a5):
undefined reference to
`_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1


// $ cat foo.d
class Bar { Foo!false FOO; }
struct Foo(bool S) {
  import std.format;
  const string toString(FormatSpec!char f) {
    return format("%0b", 42);
  }
  bool opEquals(V)(V other) {
    format("%s" , this);
    return false;
  }
}

// $ cat test.d
import foo;
enum Mode: int {SINGLE}
void main() {
  import std.stdio;
  import std.format;
  Mode mode;
  writeln(format("%08b", 42), mode);
}

--
Jul 16 2022