mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 02:43: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.
21 lines
275 B
D
21 lines
275 B
D
module aa4;
|
|
|
|
void main()
|
|
{
|
|
int[int] aa;
|
|
aa = addkey(aa,42,12);
|
|
int* p = haskey(aa,42);
|
|
assert(p && *p == 12);
|
|
}
|
|
|
|
int[int] addkey(int[int] aa, int key, int val)
|
|
{
|
|
aa[key] = val;
|
|
return aa;
|
|
}
|
|
|
|
int* haskey(int[int] aa, int key)
|
|
{
|
|
return key in aa;
|
|
}
|