Fix front-end bug: Constant folding of array-of-struct index op.

If a constant object was both an array and a structure, and was
indexed with a constant, the arrayness was ignored and the wrong
subconstant selected.  This fixes that.
This commit is contained in:
John Kessenich
2016-02-01 11:57:33 -07:00
parent 9d565d9ef8
commit 9df51caba9
3 changed files with 58 additions and 5 deletions

View File

@@ -127,3 +127,15 @@ void foo3()
{
mat3x2 r32 = mm2 * mm32;
}
struct cag {
int i;
float f;
bool b;
};
const cag a0[3] = cag[3](cag(3, 2.0, true), cag(1, 5.0, true), cag(1, 9.0, false));
void foo4()
{
int a = int(a0[2].f);
}