[Issue 8557] AA error with string[string][]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 18 05:51:45 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8557


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #1 from bearophile_hugs at eml.cc 2012-08-18 05:51:44 PDT ---
A little reformatted:

import std.typecons: tuple;
string[string][] aa1; // OK
alias string[string][] AA;
void main() {
  aa1 = [["A": "B" ], ["C": "D"]];                     // OK
  aa1 ~= ["E": "F"];                                   // OK
  assert(aa1 == [["A": "B"], ["A": "B"], ["E": "F"]]); // OK
  auto a2 = tuple([["A": "B"]]);                       // OK
  AA a3 = [["A": "B" ], ["C": "D"]];                   // error
  string[string][] a4 = [["A": "B" ], ["C": "D"]];     // error
  auto a5 = [["A": "B"], ["C": "D"]];                  // error
}


It gives the errors:

test.d(9): Error: Integer constant expression expected instead of "A"
test.d(9): Error: Integer constant expression expected instead of "A"
test.d(9): Error: Integer constant expression expected instead of "C"
test.d(9): Error: Integer constant expression expected instead of "C"
test.d(9): Error: cannot implicitly convert expression ([["B"],["D"]]) of type
string[][] to string[string][]
test.d(10): Error: Integer constant expression expected instead of "A"
test.d(10): Error: Integer constant expression expected instead of "A"
test.d(10): Error: Integer constant expression expected instead of "C"
test.d(10): Error: Integer constant expression expected instead of "C"
test.d(10): Error: cannot implicitly convert expression ([["B"],["D"]]) of type
string[][] to string[string][]
test.d(11): Error: Integer constant expression expected instead of "A"
test.d(11): Error: Integer constant expression expected instead of "A"
test.d(11): Error: Integer constant expression expected instead of "C"
test.d(11): Error: Integer constant expression expected instead of "C"

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


More information about the Digitalmars-d-bugs mailing list