https://issues.dlang.org/show_bug.cgi?id=14426
Maxim Fomin <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution|--- |INVALID --- Comment #1 from Maxim Fomin <[email protected]> --- That's funny bug. Extern(C): makes 'fall through' effect on main declaration which hijacks druntime main definition, which prevents running module ctors, so some internal data is not initialized properly. This works as expected: import std.stdio; void main(){ writeln(i); } extern (C): int i; According to spec http://dlang.org/attribute.html attribute declaration; // affects the declaration attribute: // affects all declarations until the end of // the current scope declaration; declaration; ... attribute { // affects all declarations in the block declaration; declaration; ... } It seems that it implies file scope, so it works as intended, although it is confusing. Tentatively closed as resolved-invalid. --
