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


--- Comment #0 from bearophile_hugs eml.cc 2010-06-06 05:03:25 PDT ---
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



--- Comment #1 from Ellery Newcomer <ellery-newcomer utulsa.edu> 2010-06-06
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


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-10-21
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



--- Comment #3 from bearophile_hugs eml.cc 2012-10-21 13:51:00 PDT ---
(In reply to comment #2)
 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