Bug 15934 – Non-virtual super class member function call ignores 'this' type qualifier

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-04-17T14:53:00Z
Last change time
2016-10-01T11:46:30Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2016-04-17T14:53:52Z
Test case: class B { int foo() { return 1; } int foo() const { return 2; } } class C : B { override int foo() { return 3; } override int foo() const { return 4; } void test1() { assert(this.foo() == 3); assert( foo() == 3); assert(this.B.foo() == 1); assert( B.foo() == 1); } void test2() const { assert(this.foo() == 4); assert( foo() == 4); assert(this.B.foo() == 2); // fail, 1 is incorrectly returned assert( B.foo() == 2); // fail, 1 is incorrectly returned } } void test() { auto c = new C(); c.test1(); c.test2(); }
Comment #1 by k.hara.pg — 2016-04-17T14:56:38Z
Comment #2 by github-bugzilla — 2016-05-07T05:38:36Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/dffac81a0da80b5d0603b00274666c6ef2ce3d8a fix Issue 15934 - Non-virtual super class member function call ignores 'this' type qualifier https://github.com/dlang/dmd/commit/ff797a44fefd807a0980e68985b58ed9d587c738 Merge pull request #5679 from 9rnsr/fix15934 Issue 15934 - Non-virtual super class member function call ignores 'this' type qualifier
Comment #3 by github-bugzilla — 2016-10-01T11:46:30Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/dffac81a0da80b5d0603b00274666c6ef2ce3d8a fix Issue 15934 - Non-virtual super class member function call ignores 'this' type qualifier https://github.com/dlang/dmd/commit/ff797a44fefd807a0980e68985b58ed9d587c738 Merge pull request #5679 from 9rnsr/fix15934