[Issue 17607] not an associative array initializer
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 9 19:35:51 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=17607
--- Comment #5 from Andre <andre at s-e-a-p.de> ---
(In reply to John Colvin from comment #3)
> My use case involves structures with these initialisers being used by people
> who aren't really D programmers, so it looks bad and is confusing to have
> the extra `( ... )` for me too.
>
> Hopefully there is a solution. I don't think it's a case of needing improved
> syntax in the language, it's just a compiler bug.
I just have another look. The workaround is unfortunately not working but
causing a lot of errors:
struct PutItemRequest
{
AttributeValue[string] item;
}
struct AttributeValue
{
string S;
}
void main()
{
PutItemRequest request = {
item: ([
"field1": {S: "LALA"}
])
};
}
test2.d(15): Error: found } when expecting ; following statement
test2.d(16): Error: found ] instead of statement
test2.d(17): Error: found ; when expecting ,
test2.d(18): Error: expression expected, not }
test2.d(18): Error: key:value expected for associative array literal
test2.d(18): Error: found EOF when expecting ,
test2.d(14): Error: found EOF when expecting ]
test2.d(14): Error: found EOF when expecting )
test2.d(18): Error: found end of file instead of initializer
test2.d(18): Error: semicolon expected, not EOF
test2.d(18): Error: found EOF when expecting } following compound statement
--
More information about the Digitalmars-d-bugs
mailing list