digitalmars.D.bugs - [Issue 7452] New: Function using enforce() cannot be inferred as safe because of the lazy argument
- d-bugmail puremagic.com (47/47) Feb 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7452
- d-bugmail puremagic.com (27/27) Feb 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7452
- d-bugmail puremagic.com (10/10) Feb 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7452
- d-bugmail puremagic.com (9/9) Feb 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7452
- d-bugmail puremagic.com (10/10) Feb 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7452
http://d.puremagic.com/issues/show_bug.cgi?id=7452 Summary: Function using enforce() cannot be inferred as safe because of the lazy argument Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: kennytm gmail.com --- Comment #0 from kennytm gmail.com 2012-02-06 13:22:40 PST --- Test case: ---------------------------------- import std.exception; int f7452()(int x) { enforce(x > 0); return x; } void g7452() safe pure { assert(4 == f7452(4)); } ---------------------------------- This caused error: Error: safe function 'g7452' cannot call system function 'f7452' This is because of the lazy argument, as shown with this minimal D-only test case: ---------------------------------- void e7452b(int, lazy int) pure nothrow safe {} int f7452b()(int x) { e7452b(x, 0); return x; } void g7452b() pure nothrow safe { assert(4 == f7452b(4)); } ---------------------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 06 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7452 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Function using enforce() |Function using enforce() |cannot be inferred as safe |cannot be inferred as safe |because of the lazy |because of anonymous |argument |function due to lazy | |argument --- Comment #1 from kennytm gmail.com 2012-02-07 12:10:39 PST --- Further reduced test case, showing the cause is the function/delegate type, not 'lazy'. ----------------- int f7452c()(int x) { auto y = function int() { return 0; }; return x; } void g7452c() pure nothrow safe { assert(4 == f7452c(4)); } ----------------- Note that 'pure' and 'nothrow' are correctly inferred. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7452 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #2 from kennytm gmail.com 2012-02-07 13:01:01 PST --- https://github.com/D-Programming-Language/dmd/pull/700 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7452 --- Comment #3 from github-bugzilla puremagic.com 2012-02-19 15:00:39 PST --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b9938baed4f3a0d3606d40ad435ca0e18176980e Merge pull request #700 from kennytm/bug7452_lazy_safe Bug 7452 ( safe inference failed with a function literal inside) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 19 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7452 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 19 2012