[Issue 5143] New: Static array of function literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 31 06:15:59 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5143

           Summary: Static array of function literals
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-10-31 06:15:06 PDT ---
This code works correctly with DMD 2.050:


void f1(int a) {}
static void function(int a)[] foo = [&f1];
void main() {}


But this doesn't compile:


static void function(int a)[] foo = [function(int a) {}];
void main() {}


The error message:

test.d(1): Error: non-constant expression __funcliteral1

I think this second version of the code too is correct.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list