On Monday, 10 April 2017 at 20:49:58 UTC, Stefan Koch wrote:
On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch
wrote:
[ ... ]
Hi Guys :)
I am currently fixing a bug involving complex members of structs
(where complex means (slice, struct, array or pointer))
I did expect them to be broken ...
but not to be _that_ broken :)
struct S
{
uint[] slice;
}
uint fn()
{
S s;
s.slice.length = 12;
return cast(uint)s.slice.length;
}
static assert(fn() == 12);
This code will not work because s.slice has no elementType :)
(which does not mean it has the s.slice[0] has the type void)
newCTFE literally looses the type information somewhere.
And people wonder why I don't like mondays :)
I found out that slice was never allocated :)
This is an orthogonal problem, but it's fixed now.
The problem from the above post still remains.
And I still don't know why it happens.