1 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96152
2 // { dg-additional-options "-fmain -funittest" }
4 // { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
5 auto assocArray(Keys
, Values
)(Keys keys
, Values values
)
9 if (values
.length
> keys
.length
)
10 values
= values
[0 .. keys
.length
];
11 else if (keys
.length
> values
.length
)
12 keys
= keys
[0 .. values
.length
];
13 aa
= aaLiteral(keys
, values
);
15 alias Key
= typeof(keys
[0]);
16 alias Value
= typeof(values
[0]);
17 return (() @trusted => cast(Value
[Key
]) aa
)();
22 struct ThrowingElement
28 throw new Exception("");
31 assert(assocArray([ThrowingElement()], [0]) == [ThrowingElement(): 0]);