www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2634] New: Function literals are non-constant.

reply d-bugmail puremagic.com writes:
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.


-- 
Jan 29 2009
next sibling parent d-bugmail puremagic.com writes:
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: -------
Oct 31 2010
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Mar 11 2011