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



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



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



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



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