www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - that mutable typeinfo thing

reply Adam D. Ruppe <destructionator gmail.com> writes:
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




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
Nov 20 2020
parent reply kinke <noone nowhere.com> writes:
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.
Nov 21 2020
parent Adam D. Ruppe <destructionator gmail.com> writes:
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 :)
Nov 21 2020