Bug 9383 – Wrong context for contracts if closure [dis]appears in override function

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-24T00:24:00Z
Last change time
2017-07-22T12:35:59Z
Keywords
contracts, pull, wrong-code
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2013-01-24T00:24:55Z
--- import std.stdio; void delegate() del; abstract class A { void f(int i) in { writeln("A.f.in: i = ", i); } body { } // no closure void g(int i) in { writeln("A.g.in: i = ", i); } body { int x; del = { ++x; }; } // closure } final class B: A { override void f(int i) in { writeln("B.f.in: i = ", i); } body { int x; del = { ++x; }; } // closure appears override void g(int i) in { writeln("B.g.in: i = ", i); } body { } // closure disappears } void main() { auto b = new B(); b.f(107); b.g(108); } --- Output: --- A.f.in: i = 909192741 A.g.in: i = 10428304 --- Also see Issue 6417.
Comment #1 by k.hara.pg — 2015-06-30T12:14:00Z
Comment #2 by k.hara.pg — 2015-07-01T07:44:35Z
*** Issue 13339 has been marked as a duplicate of this issue. ***
Comment #3 by k.hara.pg — 2015-07-01T08:03:00Z
*** Issue 9897 has been marked as a duplicate of this issue. ***
Comment #4 by github-bugzilla — 2015-07-06T20:38:22Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/47d9320e73b7fc6e95ef6bb9d9b571ab8a4548d8 fix Issue 9383 - Wrong context for contracts if closure [dis]appears in override function https://github.com/D-Programming-Language/dmd/commit/8e8781489d7fdcfe486020644ed31b2f8d774d8e Merge pull request #4788 from 9rnsr/fix9383 Issue 9383 - Wrong context for contracts if closure [dis]appears in override function
Comment #5 by github-bugzilla — 2017-07-22T12:35:59Z
Commits pushed to dmd-cxx at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/47d9320e73b7fc6e95ef6bb9d9b571ab8a4548d8 fix Issue 9383 - Wrong context for contracts if closure [dis]appears in override function https://github.com/dlang/dmd/commit/8e8781489d7fdcfe486020644ed31b2f8d774d8e Merge pull request #4788 from 9rnsr/fix9383