Error: Global variable type does not match previous declaration with same mangled name:

kinke noone at
Sun Nov 22 19:53:51 UTC 2020

On Sunday, 22 November 2020 at 17:46:16 UTC, Adam D. Ruppe wrote:
> pragma(mangle, "_D" ~ T.mangleof[1..$] ~ "6__initZ")
> // llvm says it is supposed to be { [2 x i8*]*, i8* }       
> __gshared extern immutable idk initializer;

Yeah, this trick only works for (non-zero-initialized) structs.

> I just want to get at the raw bytes defined by that symbol and 
> I don't think the D language can actually express that.

Yeah, I think the proper way would be the addition of a new trait 
for aggregates, e.g., `__traits(initializer, T)`, with semantics 
equivalent to current `TypeInfo.initializer()` - returning a 
`const(void)[]`, and ptr being null for zero-initialized structs.

That wouldn't just be useful for a TypeInfo-free emplace(), but 
also for moving TypeInfo generation from the compiler to druntime 

More information about the digitalmars-d-ldc mailing list