Looks like mixing of release and non-release causes this.
foo-release -> does not generate __switch_error.
test-non-release -> generates __switch_error, but assumes that `foo` will too, so elides the emission. This results in the undefined reference.
Confirmed that in 2.098, test-non-release always emits __switch_error.
Comment #3 by puneet — 2022-07-23T16:57:57Z
Using git bisect I hit the dmd version 2acf5570964ef1eaa403b602b86d41cac5567655.
This is the commit that introduced the error >>>>
commit 2acf5570964ef1eaa403b602b86d41cac5567655 (HEAD)
Author: Martin Kinkelin <[email protected]>
Date: Mon Jan 24 11:00:34 2022 +0100
Remove -unittest special cases wrt. template emission (#13224)
* WIP: Remove -unittest special cases wrt. template emission
* WIP
* WIP2
* WIP3
* WIP4
* WIP5
* Print full compiler command-line in case building the unit_test_runner executable fails
* WIP6
* WIP7
* Ignore unittest blocks in non-root modules
* Temporary: Test with enforced -allinst
* Revert "Temporary: Test with enforced -allinst"
This reverts commit 6f1a5302d7cb981654e55722860fae0ddadbbc07.
* Add comment as to why unittests in non-root modules are ignored
And ignore them for doDocComments/doHdrGeneration too, for
consistency.
* Add changelog entry
Comment #4 by kinke — 2022-07-23T21:19:37Z
(In reply to Iain Buclaw from comment #2)
> Looks like mixing of release and non-release causes this.
>
> foo-release -> does not generate __switch_error.
>
> test-non-release -> generates __switch_error, but assumes that `foo` will
> too, so elides the emission. This results in the undefined reference.
>
> Confirmed that in 2.098, test-non-release always emits __switch_error.
Makes perfect sense, and is accordingly no regression, just a missed case of culling which is now properly culled. Linking code compiled with different flags affecting template codegen is a well-known issue, and `-allinst` is supposed to handle that, but isn't enough in all cases (which are real bugs, either regarding template emission or inconsistent attributes inference).
Comment #5 by ibuclaw — 2022-07-23T21:29:45Z
(In reply to kinke from comment #4)
> (In reply to Iain Buclaw from comment #2)
> > Looks like mixing of release and non-release causes this.
> >
> > foo-release -> does not generate __switch_error.
> >
> > test-non-release -> generates __switch_error, but assumes that `foo` will
> > too, so elides the emission. This results in the undefined reference.
> >
> > Confirmed that in 2.098, test-non-release always emits __switch_error.
>
> Makes perfect sense, and is accordingly no regression, just a missed case of
> culling which is now properly culled. Linking code compiled with different
> flags affecting template codegen is a well-known issue, and `-allinst` is
> supposed to handle that, but isn't enough in all cases (which are real bugs,
> either regarding template emission or inconsistent attributes inference).
Or perhaps when importing modules across (multiple) DSO boundaries, only expose .di interface files between them.
Comment #6 by ibuclaw — 2024-02-20T13:23:37Z
Marking this as duplicate.
*** This issue has been marked as a duplicate of issue 20802 ***