https://issues.dlang.org/show_bug.cgi?id=7319
Marco Leise <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|minor |normal --- Comment #4 from Marco Leise <[email protected]> --- Three years later and this is still open. I don't think it is the difficulty of the problem. I'm raising this to 'normal'. Here is a test case that _should_ result in a few KiB executable, but creates a 7 MiB one. Every instantiation of the templated structs adds 1 MiB. Some, but not all of these unnecessary .inits are also accessible at runtime: ---------8<------------- import std.typetuple; import std.stdio; struct StuffDefault(T) { T[1024 * 1024] m_data; } struct StuffVoid(T) { T[1024 * 1024] m_data = void; } struct StuffZero(T) { T[1024 * 1024] m_data = 0; } void main(string[] args) { alias Ts = TypeTuple!( StuffDefault!void, StuffVoid!void, StuffDefault!ubyte, StuffVoid!ubyte, StuffZero!ubyte, StuffVoid!char, StuffZero!char, ); // .inits visible at runtime foreach (T; Ts) { writefln("Does %s have a superfluous init? %s", T.stringof, typeid(T).init.ptr is null ? "no" : "YES"); } } ----------->8------------ Prints: Does StuffDefault!void have a superfluous init? no Does StuffVoid!void have a superfluous init? YES Does StuffDefault!ubyte have a superfluous init? no Does StuffVoid!ubyte have a superfluous init? YES Does StuffZero!ubyte have a superfluous init? YES Does StuffVoid!char have a superfluous init? YES Does StuffZero!char have a superfluous init? YES --
