[Issue 17404] New: creating type named 'object' fails to compile, but only if you import something

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue May 16 20:27:26 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17404

          Issue ID: 17404
           Summary: creating type named 'object' fails to compile, but
                    only if you import something
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: johnnymarler at gmail.com

The following compiles today:

struct object{}

OR

class object{]

But as soon as you import anything, even just an empty module, DMD will give
you the following error:

Error: struct mymodule.object conflicts with import mymodule.object at
mymodule.d

Again, if you don't have any imports it WILL compile, but if you import
anything, even an empty module then you get this odd error message.

I'm not sure if D allows you to name types 'object'.  If it does then this is
clearly a bug in the compiler.  If it doesn't then the error message should be
fixed.

--


More information about the Digitalmars-d-bugs mailing list