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



*** 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 next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2634




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
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2634


yebblies <yebblies gmail.com> changed:

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



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: -------
Aug 31 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Aug 31 2011