October 17, 2013 [Issue 11286] New: Impure dtor makes "cannot call impure function" error, although it won't actually be called. | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=11286 Summary: Impure dtor makes "cannot call impure function" error, although it won't actually be called. 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: k.hara.pg@gmail.com --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2013-10-17 01:36:48 PDT --- From: http://forum.dlang.org/thread/wqxziknnhlyoyetwmtyu@forum.dlang.org ===================================== I get this error: ---- /d701/f223.d(11): Error: pure function 'f223.getA' cannot call impure function 'f223.A.~this' ---- with this code: ---- import std.stdio; struct A { public: ~this() { writeln("DTor"); } } A getA() pure nothrow { return A(); } void main() { A a = getA(); writeln("end of main"); } ---- But without pure and nothrow I get this output: ---- end of main DTor ---- Why the compiler thinks that the function should/could call A::~this? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 17, 2013 [Issue 11286] Impure dtor makes "cannot call impure function" error, although it won't actually be called. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=11286 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-10-17 01:44:22 PDT --- https://github.com/D-Programming-Language/dmd/pull/2677 -- 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