digitalmars.D.bugs - [Issue 5143] New: Static array of function literals
- d-bugmail puremagic.com (27/27) Oct 31 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5143
- d-bugmail puremagic.com (10/10) Oct 31 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5143
- d-bugmail puremagic.com (25/25) Oct 31 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5143
- d-bugmail puremagic.com (14/14) Oct 31 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5143
- d-bugmail puremagic.com (11/11) Oct 31 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5143
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 puremagic.com ReportedBy: bearophile_hugs eml.cc 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: -------
Oct 31 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5143 Adrian Matoga <epi atari8.info> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |epi atari8.info upvoted! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 31 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5143 Denis Derman <denis.spir gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |denis.spir gmail.com --- The bug report states an issue about func arrays, but: // ok void f () {} ; static void function() foo = &f ; // not ok static void function() foo = function void() {}; --> Error: non-constant expression __funcliteral1 It seems to me the issue is that one cannot initialise a function variable with the expression of a function. (Array or not.) What does the compiler expect there? What does the error mean? As we have function literals, they should, I guess, be usable where other literals are accepted. Note: auto foo = function void() {}; throws the same error. Denis -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 31 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5143 Denis Derman <denis.spir gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://d.puremagic.com/issu | |es/show_bug.cgi?id=2634 --- This is already filed as bug 2634 "Function literals are non-constant". http://d.puremagic.com/issues/show_bug.cgi?id=2634. Denis -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 31 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5143 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE *** This issue has been marked as a duplicate of issue 2634 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 31 2010