digitalmars.D.bugs - [Issue 22427] New: betterC: casting an array causes linker error in
- d-bugmail puremagic.com (39/39) Oct 18 2021 https://issues.dlang.org/show_bug.cgi?id=22427
https://issues.dlang.org/show_bug.cgi?id=22427 Issue ID: 22427 Summary: betterC: casting an array causes linker error in string comparison. Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: dave287091 gmail.com This reduced code fails to link. // foo.d extern(C) int main(){ if("a" == "a") return 1; char[] p; auto a = cast(int[])p; return 0; } A linker error results: Undefined symbols for architecture x86_64: "__D4core8internal5array8equality__T8__equalsTaTaZQoFNaNbNiNeMxAaMxQeZb", referenced from: _main in foo.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: /usr/bin/cc failed with status: 1 The undefined symbol demangles to: pure nothrow nogc trusted bool core.internal.array.equality.__equals!(char, char).__equals(scope const(char[]), scope const(char[])) I have verified this problem happens both with dmd and ldc2. ldc2 1.24 - 1.28 has the error. Older ldc do not. Current dmd has the error, I don’t know how far back. --
Oct 18 2021