digitalmars.D.bugs - [Issue 11091] New: Deduced purity doesn't work?
- d-bugmail puremagic.com (34/34) Sep 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11091
- d-bugmail puremagic.com (16/16) Sep 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11091
http://d.puremagic.com/issues/show_bug.cgi?id=11091 Summary: Deduced purity doesn't work? Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: simendsjo gmail.com Tried running dmd+phobos head at some code, but got errors. This is probably the breaking change: https://github.com/D-Programming-Language/phobos/commit/7714a9c42e2cc8d794a5ee483fdd49d52995b3ac import std.exception; class E: Exception { this(string msg, string file=__FILE__, size_t line=__LINE__) { super(msg, file, line); } } void f() pure { enforceEx!E(true); } void main() { f(); } // Error: pure function 't.f' cannot call impure function 'std.exception.enforceEx!(E).enforceEx!bool.enforceEx -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11091 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID This is expected change in git-head, introduced by fixing bug 10254. In the OP code, the constructor in E is not annotated with pure. So, the expression object creation new E("msg") is essentially impure. But in 2.063 and earlier, NewExpression had wrongly ignored the called constructor purity and safety (== bug 10254). Then enforceEx!E had been also incorrectly deduced to pure. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2013