Comment #0 by burton-radons — 2009-01-29T12:35:46Z
This code fails compilation:
void test () { }
// Compiles okay.
auto a = &test;
// Error: non-constant expression __funcliteral1
auto b = function void () { };
As far as I can tell there is no reason for function literals to be non-constant if they're not synthesized during runtime.
Comment #1 by bearophile_hugs — 2010-10-31T13:47:12Z
*** Issue 5143 has been marked as a duplicate of this issue. ***
Comment #2 by dmttding — 2011-03-11T14:35:35Z
It may be useful to know that
void main() {
auto a = function void() {};
}
compiles correctly, but when a is moved outside main the Error occurs.