https://d.puremagic.com/issues/show_bug.cgi?id=11824
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |CTFE --- Comment #4 from [email protected] 2014-02-03 09:27:55 PST --- I can work *around* the issue, but there is a CTFE bug in there to begin with. Here is a reduced test case: //---- int foo(T)() { T[] arr = new T[](1); T* getAddr(ref T a) { return &a; } getAddr(arr[0]); return 5; } void main() { enum a = foo!int(); //OK! enum b = foo!(int[])(); //FAILS! } //---- main.d(6): Error: returning a pointer to a local stack variable main.d(8): called from here: getAddr(arr[0]) main.d(15): called from here: foo() //---- First of all: "foo()" ? What are the template parameters? Second, I *think* there is a rejects valid: getAddr rejects "return &a" if a is of type "T[]", but not "T". To be perfectly pedantic: a happens to be a stack variable, yes, but *not* inside "getAddr" 's scope. So this should not be rejected during CTFE I think. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
