[Issue 15086] import doesn't verify module declaration
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 13 21:17:18 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=15086
--- Comment #19 from ag0aep6g at gmail.com ---
(In reply to Andrei Alexandrescu from comment #16)
> The example in which the order of imports makes or breaks the build is
> compelling. Even better would be a bug whereby the project builds both ways
> but does different things. That would be the smoking gun.
My take on it:
foo.d:
----
version (A)
{
static import baz;
static import bar;
}
version (B)
{
static import bar;
static import baz;
}
void main()
{
import std.stdio;
writeln(bar.thing);
writeln(baz.thing);
}
----
bar.d:
----
module baz;
enum thing = "this is baz from bar.d";
----
baz.d:
----
module bar;
enum thing = "this is bar from baz.d";
----
`dmd foo.d -version=A && ./foo`:
----
this is bar from baz.d
this is bar from baz.d
----
`dmd foo.d -version=B && ./foo`:
----
this is baz from bar.d
this is baz from bar.d
----
--
More information about the Digitalmars-d-bugs
mailing list