digitalmars.D.bugs - [Issue 2256] New: cannot implicitly convert expression (__funcliteral1) to invariant
- d-bugmail puremagic.com (38/38) Jul 30 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2256
- d-bugmail puremagic.com (14/14) Jun 10 2011 http://d.puremagic.com/issues/show_bug.cgi?id=2256
- d-bugmail puremagic.com (13/17) Sep 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=2256
http://d.puremagic.com/issues/show_bug.cgi?id=2256 Summary: cannot implicitly convert expression (__funcliteral1) to invariant Product: D Version: 2.017 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: someanon yahoo.com $ dmd -c memberfunptr.d memberfunptr.d(9): Error: cannot implicitly convert expression (__funcliteral1) of type void function(A) to invariant(void function(A)) $ cat memberfunptr.d ========================================== import std.stdio; class A { void f() {writefln("f()");} void g() {writefln("g()");} } alias void function(A) FP; invariant FP mfp1 = function void(A obj) {obj.f();}; // why this doesn't work? // the following compiles, but ugly static invariant FP mfp2; static this() { mfp2 = cast(invariant FP)(function void(A obj) {obj.g();}); } ========================================== http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=74330 Why a function literal is not a constant expression? Especially after I defining a global top level wrapper function in this case. Under the hood, it should just be a raw pointer to some memory address, why this cannot be a constant? --
Jul 30 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2256 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |yebblies gmail.com Depends on| |3797 The 'is not a constant expression' part is covered by bug 2634. https://github.com/D-Programming-Language/dmd/pull/96 fixes the implicit conversion to immutable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 10 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2256 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXEDThe 'is not a constant expression' part is covered by bug 2634. https://github.com/D-Programming-Language/dmd/pull/96 fixes the implicit conversion to immutable.https://github.com/D-Programming-Language/dmd/commit/306df8eaa6f8a987f76f401a1e03d8edf1f1e2ae Now works as bug 3797 and bug 2634 have been fixed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 02 2011