September 22, 2013 [Issue 11091] New: Deduced purity doesn't work? | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from simendsjo <simendsjo@gmail.com> 2013-09-22 02:49:35 PDT --- 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: ------- |
September 22, 2013 [Issue 11091] Deduced purity doesn't work? | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | 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 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-09-22 04:15:34 PDT --- 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: ------- |
Copyright © 1999-2021 by the D Language Foundation