mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 10:53:14 +01:00
Fixed some problems with the string runtime support functions. Fixed initialization of array of structs. Fixed slice assignment where LHS is slice but RHS is dynamic array. Fixed problems with result of assignment expressions. Fixed foreach problems with key type mismatches.
25 lines
430 B
D
25 lines
430 B
D
module aa3;
|
|
|
|
void main()
|
|
{
|
|
int[string] aa;
|
|
{aa["hello"] = 1;}
|
|
{int* p = "" in aa;}
|
|
aa[" worl"] = 2;
|
|
aa["d"] = 3;
|
|
aa["thisisgreat"] = 10;
|
|
int sum;
|
|
string cat;
|
|
{
|
|
foreach(k,v;aa)
|
|
{
|
|
printf("int[%.*s] = %d\n", k.length, k.ptr, v);
|
|
sum += v;
|
|
cat ~= k;
|
|
}
|
|
}
|
|
assert(sum == 16);
|
|
printf("cat = %.*s\n", cat.length, cat.ptr);
|
|
assert(cat.length == 22);
|
|
}
|