[Issue 9293] New: enum struct with StructInitializer reports weird error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 10 22:03:37 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9293

           Summary: enum struct with StructInitializer reports weird error
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-01-10 22:03:36 PST ---
Spin-off from bug 9218. This code should run without assertion, but the
compilation fails with weird error message.

struct A
{
//  enum A zero = A(); // This works as expected
    enum A zero = {};  // Note the difference here

    int opCmp(const ref A a) const
    {
        assert(0);
    }

    int opCmp(const A a) const
    {
        return 0;
    }
}

void main()
{
    A a;
    auto b = a >= A.zero;  // Error: A() is not an lvalue
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list