DMD CTFE Bug?

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Aug 17 09:36:41 PDT 2012


On 17-Aug-12 20:27, David wrote:
> I have this code: http://dpaste.dzfl.pl/dbe2a07f
>
> It works perfectly fine, except for `t!(2, 10)` and `t!(1, 10)`:
>
> // Expected:
> [Vertex(-0.5, 0.5, 0.5, 0, 1, 0, 2, 10, 2, 10, 0, 0), Vertex(0.5, 0.5,
> 0.5, 0, 1, 0, 3, 10, 3, 10, 0, 0), Vertex(0.5,  0.5, -0.5, 0,  1, 0, 3,
> 9, 3, 9, 0, 0),
>   Vertex(-0.5, 0.5, 0.5, 0, 1, 0, 2, 10, 2, 10, 0, 0), Vertex(0.5, 0.5,
> -0.5, 0, 1, 0, 3, 9, 3, 9, 0, 0), Vertex(-0.5, 0.5, -0.5, 0, 1, 0, 2, 9,
> 2, 9, 0, 0)]
>
> // Actual result:
> [Vertex(-0.5, 0.5, 0.5, 0, 1, 0, 2, 10, 2, 10, 0, 0), Vertex(0.5, 0.5,
> 0.5, 0, 1, 0, 3, 10, 3, 10, 0, 0), Vertex(0.5, -0.5,  0.5, 0, -1, 0, 6,
> 3, 6, 3, 0, 0),
>   Vertex(-0.5, 0.5, 0.5, 0, 1, 0, 2, 10, 2, 10, 0, 0), Vertex(0.5, 0.5,
> -0.5, 0, 1, 0, 3, 9, 3, 9, 0, 0), Vertex(-0.5, 0.5, -0.5, 0, 1, 0, 2, 9,
> 2, 9, 0, 0)]
>
> If I change `enum` in line 117 to `auto` it produces the expected result.
>
> Any ideas why this happens?

Bug. There is no excuse for compiler to get different result during CTFE.

>
> (Btw. I wasn't able produce a smaller testcase)
It's not thousands of lines either. But where does Vertex type comes from?


-- 
Olshansky Dmitry


More information about the Digitalmars-d-learn mailing list