Thread overview
[Issue 2634] New: Function literals are non-constant.
Jan 29, 2009
d-bugmail
Mar 11, 2011
Taylor Everding
Sep 01, 2011
yebblies
Sep 01, 2011
Walter Bright
January 29, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2634

           Summary: Function literals are non-constant.
           Product: D
           Version: 2.023
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: burton-radons@shaw.ca


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.


-- 

October 31, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2634


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2010-10-31 13:47:12 PDT ---
*** Issue 5143 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 11, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2634



--- Comment #2 from Taylor Everding <dmttding@gmail.com> 2011-03-11 14:35:35 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 01, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2634


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com


--- Comment #3 from yebblies <yebblies@gmail.com> 2011-09-01 15:38:27 EST ---
Fixed for D2

https://github.com/D-Programming-Language/dmd/commit/8945eae1b37f1fdc96850cff697959deb2d64e6a

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 01, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2634


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2011-08-31 23:24:22 PDT ---
And D1:

https://github.com/D-Programming-Language/dmd/commit/36cee746c53c2a3dac11116e1f4c3e0563a0534c

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