www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13593] New: object.d hijacked


          Issue ID: 13593
           Summary: object.d hijacked
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: doob me.com

I have a file named "Object.d", in a directory called "foo". The module name of
this file is "foo.Object". As it happens, I'm using OS X which uses a case
insensitive file system. I also have another file, say "Bar.d" in "foo", with
the module name "foo.Bar". When I try to compile/run Bar.d with rdmd as

rdmd foo/Bar.d

I get a lot of errors like "undefined identifier string" and "undefined
identifier size_t" from some modules in druntime and Phobos. If I rename 
"foo/Object.d" to "foo/Object2.d", leaving the module name as "foo.Object"
everything works as expected.

I think the issue is that "rdmd" adds a  flag, "-Ifoo", when running dmd to get
the dependencies. But the module system should still prevent it. It seems like
the compiler uses the filename instead of the declared module name as the
module name.

This is similar to issue 90 [1]. I don't know if we should reopen that one

[1] https://issues.dlang.org/show_bug.cgi?id=90

Oct 09 2014