www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9293] New: enum struct with StructInitializer reports weird error

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: k.hara.pg gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg 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: -------
Jan 10 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9293


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-01-10 22:14:41 PST ---
https://github.com/D-Programming-Language/dmd/pull/1464

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 10 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9293



--- Comment #2 from github-bugzilla puremagic.com 2013-01-13 00:41:12 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/895f19174dffc9088c0516f2c8cc47f8f4c589fa
fix Issue 9293 - enum struct with StructInitializer reports weird error

`VarDeclaration::getConstInitializer` should return an actual expression, even
if init is not an `ExpInitializer`.

https://github.com/D-Programming-Language/dmd/commit/7f9d6c8aa9d7c7fc2d798c5e75696ef3a815192c
Merge pull request #1464 from 9rnsr/fix9293

Issue 9293 - enum struct with StructInitializer reports weird error

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9293


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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