Thread overview
Global variable type does not match previous declaration
Dec 13, 2017
Satoshi
Dec 13, 2017
Satoshi
Dec 14, 2017
Nicholas Wilson
Dec 14, 2017
Satoshi
Dec 16, 2017
Satoshi
Dec 16, 2017
Satoshi
Dec 14, 2017
Jacob Carlborg
Dec 14, 2017
Kagamin
December 13, 2017
What means this error and how to solve it?

object.d-mixin-1072(1112): Error: Global variable type does not match previous declaration with same mangled name: _D10TypeInfo_m6__initZ

Actually, I'm working on OS with minimal D runtime and I'm unable to compile object.d

source code:
https://github.com/Rikarin/Trinix/blob/a42a6e1fb4b87374b3e5ad8b9be501b080655ccd/Kernel/object.d

Thanks
December 13, 2017
On Wednesday, 13 December 2017 at 21:38:49 UTC, Satoshi wrote:
> What means this error and how to solve it?
>
> object.d-mixin-1072(1112): Error: Global variable type does not match previous declaration with same mangled name: _D10TypeInfo_m6__initZ
>
> Actually, I'm working on OS with minimal D runtime and I'm unable to compile object.d
>
> source code:
> https://github.com/Rikarin/Trinix/blob/a42a6e1fb4b87374b3e5ad8b9be501b080655ccd/Kernel/object.d
>
> Thanks

Compiling with
ldc2 -debuglib= -defaultlib= -code-model=kernel -disable-red-zone -w -wi -de -O3 -mattr=-sse -I../ -of=obj-amd64/object.d.o -c -deps=obj-amd64/object.d.o.o.dep object.d
December 14, 2017
On 2017-12-13 22:38, Satoshi wrote:
> What means this error and how to solve it?
> 
> object.d-mixin-1072(1112): Error: Global variable type does not match previous declaration with same mangled name: _D10TypeInfo_m6__initZ
> 
> Actually, I'm working on OS with minimal D runtime and I'm unable to compile object.d
> 
> source code:
> https://github.com/Rikarin/Trinix/blob/a42a6e1fb4b87374b3e5ad8b9be501b080655ccd/Kernel/object.d 

I think this can occur with LDC when the compiler sees multiple symbols that it think it should have the same mangled name but they don't. Or the opposite, multiple symbols that should have different mangled names but have the same. This is pretty easy to simulate with pragma(mangle).

-- 
/Jacob Carlborg
December 14, 2017
On Wednesday, 13 December 2017 at 21:39:40 UTC, Satoshi wrote:
> On Wednesday, 13 December 2017 at 21:38:49 UTC, Satoshi wrote:
>> What means this error and how to solve it?
>>
>> object.d-mixin-1072(1112): Error: Global variable type does not match previous declaration with same mangled name: _D10TypeInfo_m6__initZ
>>
>> Actually, I'm working on OS with minimal D runtime and I'm unable to compile object.d
>>
>> source code:
>> https://github.com/Rikarin/Trinix/blob/a42a6e1fb4b87374b3e5ad8b9be501b080655ccd/Kernel/object.d
>>
>> Thanks
>
> Compiling with
> ldc2 -debuglib= -defaultlib= -code-model=kernel -disable-red-zone -w -wi -de -O3 -mattr=-sse -I../ -of=obj-amd64/object.d.o -c -deps=obj-amd64/object.d.o.o.dep object.d

Can you add -vv to the command line and post the relevant portion of the result (i.e. the portion that correlates to the symbol that gives the error)?  (You'll want to pipe the output to a file as it produces a lot of output.)
December 14, 2017
On Wednesday, 13 December 2017 at 21:38:49 UTC, Satoshi wrote:
> What means this error and how to solve it?
>
> object.d-mixin-1072(1112): Error: Global variable type does not match previous declaration with same mangled name: _D10TypeInfo_m6__initZ

Try to write typeinfo as is without mixin.
December 14, 2017
On Thursday, 14 December 2017 at 12:18:22 UTC, Nicholas Wilson wrote:
> On Wednesday, 13 December 2017 at 21:39:40 UTC, Satoshi wrote:
>> On Wednesday, 13 December 2017 at 21:38:49 UTC, Satoshi wrote:
>>> [...]
>>
>> Compiling with
>> ldc2 -debuglib= -defaultlib= -code-model=kernel -disable-red-zone -w -wi -de -O3 -mattr=-sse -I../ -of=obj-amd64/object.d.o -c -deps=obj-amd64/object.d.o.o.dep object.d
>
> Can you add -vv to the command line and post the relevant portion of the result (i.e. the portion that correlates to the symbol that gives the error)?  (You'll want to pipe the output to a file as it produces a lot of output.)

Here is output from -vv
https://gist.github.com/anonymous/0a48808969600a84a683c03df57b5a29
December 16, 2017
I commented out the TypeInfo declarations and got the same error but on different symbol.

object.d(1569): Error: Function type does not match previously declared function with the same mangled name: _d_dynamic_cast


https://github.com/Rikarin/Trinix/blob/master/Kernel/object.d#L1569

https://travis-ci.org/Rikarin/Trinix/builds/317288016?utm_source=github_status&utm_medium=notification

I have no idea what's wrong with that.
Any ideas?


Thanks.
December 16, 2017
On Saturday, 16 December 2017 at 09:04:05 UTC, Satoshi wrote:
> I commented out the TypeInfo declarations and got the same error but on different symbol.
>
> object.d(1569): Error: Function type does not match previously declared function with the same mangled name: _d_dynamic_cast
>
>
> https://github.com/Rikarin/Trinix/blob/master/Kernel/object.d#L1569
>
> https://travis-ci.org/Rikarin/Trinix/builds/317288016?utm_source=github_status&utm_medium=notification
>
> I have no idea what's wrong with that.
> Any ideas?
>
>
> Thanks.

Actually, it seems like bug in LDC (compilation with DMD works fine).
I opened issue https://github.com/ldc-developers/ldc/issues/2453