struct G { } struct F(T) { void f(ref T) { } } pragma(msg, F!G().f(G.init)); void main() { }
This is the CTFE problem on out of function scope. struct G {} struct F(T) { void f(ref T) {} } pragma(msg, F!G().f(G.init)); // ICE enum b = { F!G().f(G.init); return true; }(); // OK void main() { F!G().f(G.init); // OK }
Before CTFE begins, the code in comment 1 is translated into: F().f((G __tmpsl5 = G(); , __tmpsl5)) The problem is that the comma expression is evaluated outside of CTFE. This would be fixed by bug 7988.
I get the following message from 2.064 head: test.d(3): Error: function test.F!(G).F.f (ref G _param_0) is not callable using argument types (G) test.d(3): while evaluating pragma(msg, F().f(G())) No ice.
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/053c0d2ab1cd239714cf1d4078e89a76b2eb6ec0 fix Issue 8255 - [CTFE] ICE when passing 'ref' literal