---- module main; const char[] CT_STRING = "int i=0;"; void main(){ mixin( CT_STRING ); } ---- The string can be found in the executable.
That is correct. that other module "use_CT_STRING.d" could import it. Its removal can only be done by whole program optimizations and or the external linker. Have you tried actually declaring a compile time string like this?: enum CT_STRING = "int i = 0;";
Indeed, this is the correct behavior. `static immutable` + initializer, or `static const` + initializer leads to a manifest constant which is an lvalue (you can take the address of it). On the other hand, `enum` leads to an rvalue (much like a define, it is copy pasted everywhere). Closing as INVALID.