www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4281] New: AA literal problem with mutable array as key

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

           Summary: AA literal problem with mutable array as key
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This D2 code seems correct:


void main() {
    int[int[]] aa = [[1]: 2];
}


But DMD v2.046 prints at compile-time:

test.d(2): comma expected separating array initializers, not :
test.d(2): semicolon expected, not '3'
test.d(2): found ']' when expecting ';' following 'statement'

See also Bug 4279

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




08:00:00 PDT ---
Created an attachment (id=656)
mind a bit more lookahead?

your code looks fine. dmd's parser doesn't honor the second line in

ArrayMemberInitialization:
    NonVoidInitializer
    AssignExpression : NonVoidInitializer

for array literals.

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


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |FIXED



13:25:31 PDT ---
It compiles now, although I'm not sure if such a key should be allowed..

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 21 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4281





 It compiles now, although I'm not sure if such a key should be allowed..
The type of the key of this associative array is actually "const int[]", despite the type signature says something different... So the keys are OK. It's the associative array type signature that is not good. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 21 2012