[Issue 21723] New: Linker error: two module static library, main compiled inline, invariant that defines a function, type alias, and an alias lambda
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 16 08:01:34 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21723
Issue ID: 21723
Summary: Linker error: two module static library, main compiled
inline, invariant that defines a function, type alias,
and an alias lambda
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: default_357-line at yahoo.de
Sorry for the random list of keywords in the summary but this one is pretty
opaque.
Take two modules:
a.d:
import b;
alias Struct = b.Struct;
b.d:
struct Struct {
invariant { void call() { } }
void templfun()() { }
}
main.d:
import a;
void trigger(Instance val) { val.templfun; }
void main() { alias lambda = a => a; }
Build as such:
dmd a.d b.d -lib -oflibrary.a
dmd -inline main.d ./library.a
Behold the linker error.
/usr/bin/ld: main.o: in function `pure nothrow @nogc @safe void
b.Struct.templfun!().templfun()':
main.d:(.text.pure nothrow @nogc @safe void
b.Struct.templfun!().templfun()[pure nothrow @nogc @safe void
b.Struct.templfun!().templfun()]+0xd): undefined reference to `const void
b.Struct.__invariant3()'
/usr/bin/ld: main.d:(.text.pure nothrow @nogc @safe void
b.Struct.templfun!().templfun()[pure nothrow @nogc @safe void
b.Struct.templfun!().templfun()]+0x19): undefined reference to `const void
b.Struct.__invariant3()'
collect2: error: ld returned 1 exit status
Might be another case of #14429 ?
--
More information about the Digitalmars-d-bugs
mailing list