Thread overview
[Issue 19807] undefined reference involving separate compilation, `unittest`, `double`
Apr 14, 2019
kinke@gmx.net
Apr 14, 2019
kinke@gmx.net
Apr 14, 2019
ag0aep6g
Dec 17, 2022
Iain Buclaw
April 14, 2019
https://issues.dlang.org/show_bug.cgi?id=19807

kinke@gmx.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke@gmx.net

--- Comment #1 from kinke@gmx.net ---
The `double` field is required to make the Tuple struct template non-zero-initialized, so that the init symbol is actually required. You'd have the same issue with an `int expand = 1` field.

For some reason, the TypeInfo for Tuple is emitted into the `main` module, but the init symbol isn't.

--
April 14, 2019
https://issues.dlang.org/show_bug.cgi?id=19807

--- Comment #2 from kinke@gmx.net ---
Another question is whether the unittest is actually supposed to be 'instantiated' by the import of the module alone. The PosixEventDriver class template isn't instantiated in the main module, so I'd say it should not.

--
April 14, 2019
https://issues.dlang.org/show_bug.cgi?id=19807

--- Comment #3 from ag0aep6g <ag0aep6g@gmail.com> ---
A slight variation with opEquals and opCmp:

----
struct Tuple()
{
    bool opEquals(const Tuple other) const { assert(false); }
    int opCmp(const Tuple other) const { assert(false); }
}
----

Rest as above.

Output:
----
/usr/bin/ld: main.o: in function
`_D14eventcore_core__T5TupleZQh11__xopEqualsFKxSQBt__TQBgZQBkKxQqZb':
main.d:(.text._D14eventcore_core__T5TupleZQh11__xopEqualsFKxSQBt__TQBgZQBkKxQqZb[_D14eventcore_core__T5TupleZQh11__xopEqualsFKxSQBt__TQBgZQBkKxQqZb]+0xe):
undefined reference to
`_D14eventcore_core__T5TupleZQh8opEqualsMxFNaNbNiNfxSQBy__TQBlZQBpZb'
/usr/bin/ld: main.o: in function
`_D14eventcore_core__T5TupleZQh8__xopCmpFKxSQBp__TQBcZQBgKxQqZi':
main.d:(.text._D14eventcore_core__T5TupleZQh8__xopCmpFKxSQBp__TQBcZQBgKxQqZi[_D14eventcore_core__T5TupleZQh8__xopCmpFKxSQBp__TQBcZQBgKxQqZi]+0xb):
undefined reference to
`_D14eventcore_core__T5TupleZQh5opCmpMxFNaNbNiNfxSQBv__TQBiZQBmZi'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
----

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=19807

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--