www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Global variable type does not match previous declaration

reply Satoshi <satoshi rikarin.org> writes:
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
Dec 13 2017
next sibling parent reply Satoshi <satoshi rikarin.org> writes:
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
Dec 13 2017
parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
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.)
Dec 14 2017
parent reply Satoshi <satoshi rikarin.org> writes:
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
Dec 14 2017
parent reply Satoshi <satoshi rikarin.org> writes:
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.
Dec 16 2017
parent Satoshi <satoshi rikarin.org> writes:
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
Dec 16 2017
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
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/a42a6e1fb4b87374b3e5ad8b9be501b08065
ccd/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
Dec 14 2017
prev sibling parent Kagamin <spam here.lot> writes:
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.
Dec 14 2017