Thread overview
[Issue 6049] New: [CTFE]: Array literals of structs with invariant() are wrong
May 24, 2011
Don
May 24, 2011
Jonathan M Davis
May 24, 2011
Don
May 24, 2011
Jonathan M Davis
May 27, 2011
Don
May 24, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6049

           Summary: [CTFE]: Array literals of structs with invariant() are
                    wrong
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: clugdbug@yahoo.com.au


--- Comment #0 from Don <clugdbug@yahoo.com.au> 2011-05-23 21:27:29 PDT ---
Applies only to the latest DMD in git. Reduced from unittest failure in std.datetime.
---
struct Bug6049 {
    int m;
    this(int x)  {  m = x; }
    invariant() { }
}

const Bug6049[] foo6049 = [Bug6049(6),  Bug6049(17)];

static assert(foo6049[0].m == 6);
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 24, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6049


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-05-23 21:35:53 PDT ---
So, as a temporary fix to make the autotester is passing, commenting out the invariants should fix the problem?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 24, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6049



--- Comment #2 from Don <clugdbug@yahoo.com.au> 2011-05-24 00:41:06 PDT ---
(In reply to comment #1)
> So, as a temporary fix to make the autotester is passing, commenting out the invariants should fix the problem?

Yes, but I already have a DMD pull request that fixes the problem <g>.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 24, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6049



--- Comment #3 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-05-24 10:11:43 PDT ---
Then I won't worry about it :). Invariants have been a source of trouble with std.datetime though and appear to be an area in the language implementation that still has some warts. IIRC, it caused some issues with purity initially (though we can now have pure invarians fortunately), and bug# 5058 has caused definite issues as well (hence why SysTime's invariant is commented out). Well, as annoying as such bugs are, at least we're running into them so that we can fix them. Thanks for looking into this one.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 27, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6049


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2011-05-27 12:52:10 PDT ---
https://github.com/D-Programming-Language/dmd/commit/91ffa267803aae2d639b60acfa566cf3294e66f8

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