Thread overview
that mutable typeinfo thing
Nov 21, 2020
Adam D. Ruppe
Nov 21, 2020
kinke
Nov 21, 2020
Adam D. Ruppe
November 21, 2020
So I have my little `class TypeInfo_Aya {}` stub. Sometimes it works. But if I dare to add a string to a struct, it generates this infamous error:


arsd-webassembly/object.d(221): Error: Global variable type does not match previous declaration with same mangled name: `_D12TypeInfo_Aya6__initZ`
arsd-webassembly/object.d(221):        Previous IR type: %object.TypeInfo_Array = type { [4 x i8*]*, i8*, %object.TypeInfo* }, mutable, non-thread-local
arsd-webassembly/object.d(221):        New IR type:      %object.TypeInfo_Aya = type { [4 x i8*]*, i8*, %object.TypeInfo* }, const, non-thread-local



So how do I tell it I just don't give a !@#$ and carry on? I tried looking at ldc/druntime's source and i don't see how their thing is any different.

Like I see the comment here https://github.com/ldc-developers/ldc/blob/c5b9f8a9048e46322301575546ed60fa79d5f2c9/ir/irstruct.cpp#L36

and yeah it definitely has to do with a struct... but like i just don't know the magic incantation to solve it.

btw tried pragma(LDC_no_typeinfo) on my struct too. ineffective.

i haven't tried compiling object.d as a separate .lib file... maybe with weak linkage? i really would prefer not to... but is that the answer? there must be something
November 21, 2020
On Saturday, 21 November 2020 at 05:46:25 UTC, Adam D. Ruppe wrote:
> arsd-webassembly/object.d(221): Error: Global variable type does not match previous declaration with same mangled name: `_D12TypeInfo_Aya6__initZ`
> arsd-webassembly/object.d(221):        Previous IR type: %object.TypeInfo_Array = type { [4 x i8*]*, i8*, %object.TypeInfo* }, mutable, non-thread-local
> arsd-webassembly/object.d(221):        New IR type:      %object.TypeInfo_Aya = type { [4 x i8*]*, i8*, %object.TypeInfo* }, const, non-thread-local

This should have been fixed by https://github.com/ldc-developers/ldc/pull/3599.
November 21, 2020
On Saturday, 21 November 2020 at 12:16:39 UTC, kinke wrote:
> This should have been fixed by https://github.com/ldc-developers/ldc/pull/3599.

Ah, the nightly build works! thanks :)