d: Fix gdc -O2 -mavx generates misaligned vmovdqa instruction [PR114171]
[official-gcc.git] / gcc / testsuite / gdc.dg / torture / pr96152.d
blob86d3f9185d5a329b38fe5e52fbe1356eaff40e68
1 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96152
2 // { dg-additional-options "-fmain -funittest" }
3 // { dg-do run }
4 // { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
5 auto assocArray(Keys, Values)(Keys keys, Values values)
7 void* aa;
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)();
20 @safe unittest
22 struct ThrowingElement
24 int i;
25 static bool b;
26 ~this(){
27 if (b)
28 throw new Exception("");
31 assert(assocArray([ThrowingElement()], [0]) == [ThrowingElement(): 0]);