Thread overview
[Issue 6283] New: [CTFE][Regression 2.054] Failed to assign to AA using a constness-changed array as key
Jul 10, 2011
kennytm@gmail.com
Jul 10, 2011
kennytm@gmail.com
Jul 22, 2011
Walter Bright
Jul 22, 2011
kennytm@gmail.com
Jul 22, 2011
kennytm@gmail.com
Jul 26, 2011
Walter Bright
July 10, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6283

           Summary: [CTFE][Regression 2.054] Failed to assign to AA using
                    a constness-changed array as key
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: kennytm@gmail.com


--- Comment #0 from kennytm@gmail.com 2011-07-10 12:57:54 PDT ---
Test case:


-----------------------------------
static assert( {
    immutable qq = "qq";
    string q = qq;   // <-- from immutable(char[]) to immutable(char)[]

    int[string] pieces = ["a":1];
    pieces[q] = 0;   // <-- can't interpret

    return true;
}() );
-----------------------------------
x.d(9): Error: cannot evaluate delegate pure nothrow bool()
{
immutable immutable(char[]) qq = "qq";
string q = qq;
int[string] pieces = ["a":1];
pieces[q] = 0;
return true;
}
() at compile time
x.d(1): Error: static assert  (delegate pure nothrow bool()
{
immutable immutable(char[]) qq = "qq";
string q = qq;
int[string] pieces = ["a":1];
pieces[q] = 0;
return true;
}
()) is not evaluatable at compile time
-----------------------------------

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



--- Comment #1 from kennytm@gmail.com 2011-07-10 13:07:57 PDT ---
The regression was introduced in commit 08352 in fixing the type-painting bug revealed by bug 4063.

https://github.com/D-Programming-Language/dmd/commit/08352

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


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-07-21 20:34:18 PDT ---
https://github.com/D-Programming-Language/dmd/commit/3309fcddfbc4e445a3e418c31a49d157c33161aa

https://github.com/D-Programming-Language/dmd/commit/2ea02077de9498746f5abb0043dc6ae1e5accefc

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


kennytm@gmail.com changed:

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


--- Comment #3 from kennytm@gmail.com 2011-07-22 01:23:57 PDT ---
Not yet fixed in these 2 slight variants:

Test case 2:
-----------------------------------
static assert({
    immutable p = "pp";
    int[string] pieces = [p: 0];
    pieces["qq"] = 1;
    return true;
}());
-----------------------------------
x.d(6): Error: cannot evaluate delegate pure nothrow bool()
....
-----------------------------------



Test case 3:
-----------------------------------
static assert({
    immutable renames = [0: "pp"];
    int[string] pieces;
    pieces[true ? renames[0] : "qq"] = 1;
    pieces["anything"] = 1;
    return true;
}());
-----------------------------------
x.d(7): Error: cannot evaluate delegate pure nothrow bool()
....
-----------------------------------

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



--- Comment #4 from kennytm@gmail.com 2011-07-22 01:40:27 PDT ---
(In reply to comment #3)
> Not yet fixed in these 2 slight variants:
> 
[snip]

... and the cause of these 2 variants are the same: Equals() in constfold.c
cannot handle (e1->op == TOKslice && e2->op == TOKstring).

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


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2011-07-26 15:19:58 PDT ---
https://github.com/D-Programming-Language/dmd/commit/0904c8aa200e4d080d500d96d5904c33ba17cc86

https://github.com/D-Programming-Language/dmd/commit/e48a8c67f02172c72e04f36759d2d6868d716368

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