www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3665] New: Assignment with array slicing does not work

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3665

           Summary: Assignment with array slicing does not work
           Product: D
           Version: 1.054
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kai redstar.de


--- Comment #0 from kai redstar.de 2010-01-02 09:01:20 PST ---
The following piece of code produces the error "Bug.d(13): Error: 'K[] =
this.hash[]' is not of integral type, it is a ulong[]" with DMD 1.053 and DMD
1.054. It worked without problems in DMD 1.050.


final class Bug
{
    private ulong hash[8];

    protected void transform(ubyte[] input)
    {
        ulong K[8];
        ulong block[8];
        ulong state[8];

        block[] = cast(ulong[]) input;

        state[] = block[] ^ (K[] = hash[]);
    }
}

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-01-03 11:44:14 PST ---
Workaround is to add [], changing this:

state[] = block[] ^ (K[] = hash[]);

into

state[] = block[] ^ (K[] = hash[])[];

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #2 from Don <clugdbug yahoo.com.au> 2010-09-13 01:00:54 PDT ---
This is very simple: in arrayop.c, the assignment operators have been left out
of the lists of valid operations.

PATCH:

bool isArrayOpValid(Expression *e), line 54.

            case TOKand:
            case TOKor:
            case TOKpow:
            case TOKand:
            case TOKor:
            case TOKpow:
+            case TOKassign:
+            case TOKaddass:
+            case TOKminass:
+            case TOKmulass:
+            case TOKdivass:
+            case TOKmodass:
+            case TOKxorass:
+            case TOKandass:
+            case TOKorass:
+            case TOKpowass:
                 return isArrayOpValid(((BinExp *)e)->e1) &&
isArrayOpValid(((BinExp *)e)->e2);

And again in isArrayOperand(), line 600

            case TOKand:
            case TOKor:
+            case TOKpow:
+            case TOKassign:
+            case TOKaddass:
+            case TOKminass:
+            case TOKmulass:
+            case TOKdivass:
+            case TOKmodass:
+            case TOKxorass:
+            case TOKandass:
+            case TOKorass:
+            case TOKpowass:
            case TOKneg:
            case TOKtilde:
                return 1;

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2010-09-21
14:01:50 PDT ---
http://www.dsource.org/projects/dmd/changeset/681

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