[Issue 16980] [REG2.072.0] wrong interface called
https://issues.dlang.org/show_bug.cgi?id=16980 Suleyman Sahmi (سليمان السهمي) changed: What|Removed |Added Status|REOPENED|RESOLVED CC||sahmi.soulaim...@gmail.com Resolution|--- |FIXED --- Comment #9 from Suleyman Sahmi (سليمان السهمي) --- > // calling the destructor still fails It fails because the field `ab` is not initialized, hence holds `null`. Try declaring `tinst` like this: ``` auto tinst = T!()(new C); ``` --
[Issue 16980] [REG2.072.0] wrong interface called
https://issues.dlang.org/show_bug.cgi?id=16980 RazvanN changed: What|Removed |Added Status|RESOLVED|REOPENED CC||razvan.nitu1...@gmail.com Resolution|FIXED |--- --- Comment #8 from RazvanN --- Slightly modified example: interface A { void foo(); } interface B { void bar(); } interface AB : A, B {} class C : AB { void foo() { assert(false, "Never called!"); } void bar() {} } struct T() { AB ab; ~this() { ab.bar(); // not OK, calls foo(); } } static ~this() // calling the destructor still fails { tinst.__dtor(); } T!() tinst; // NOTE: the destructor of tinst is never run! void main() { T!() dst; dst.ab = new C; dst.ab.bar(); // OK, calls bar() } --
[Issue 16980] [REG2.072.0] wrong interface called
https://issues.dlang.org/show_bug.cgi?id=16980 --- Comment #7 from github-bugzi...@puremagic.com --- Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/bbd22804313fa37fe2848b7f3bc45f83f4ea8db8 fix Issue 16980 - wrong interface called https://github.com/dlang/dmd/commit/6b294ff205772ef2ca0dfc3df90dc0b16c2a2772 Merge pull request #6383 from MartinNowak/fix16980 --
[Issue 16980] [REG2.072.0] wrong interface called
https://issues.dlang.org/show_bug.cgi?id=16980 --- Comment #6 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/bbd22804313fa37fe2848b7f3bc45f83f4ea8db8 fix Issue 16980 - wrong interface called https://github.com/dlang/dmd/commit/6b294ff205772ef2ca0dfc3df90dc0b16c2a2772 Merge pull request #6383 from MartinNowak/fix16980 --
[Issue 16980] [REG2.072.0] wrong interface called
https://issues.dlang.org/show_bug.cgi?id=16980 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 16980] [REG2.072.0] wrong interface called
https://issues.dlang.org/show_bug.cgi?id=16980 --- Comment #5 from github-bugzi...@puremagic.com --- Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/bbd22804313fa37fe2848b7f3bc45f83f4ea8db8 fix Issue 16980 - wrong interface called - ensure that class/interface size is finalized before determining the interface offsets https://github.com/dlang/dmd/commit/6b294ff205772ef2ca0dfc3df90dc0b16c2a2772 Merge pull request #6383 from MartinNowak/fix16980 fix Issue 16980 - wrong interface called --
[Issue 16980] [REG2.072.0] wrong interface called
https://issues.dlang.org/show_bug.cgi?id=16980 Martin Nowak changed: What|Removed |Added Summary|[REG2.072.0] vtable issue |[REG2.072.0] wrong |in slightly complex |interface called |scenario| --- Comment #4 from Martin Nowak --- So what happens is that the size finalization of aggregates (classes and structs) was moved to semantic2 in order to resolve various forward reference issues. The module level T!() tinst; declaration already triggers a FunctionDeclaration::semantic3 for the dtor during Module::semantic(). IIRC this is done for any template instances. What's missing is a call to ad.size/determineSize somewhere before determining the offset when the CastExp is optimized. --