Bug 11265 – Segfault while calling instance method of class defined inside struct

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2013-10-14T17:22:00Z
Last change time
2013-10-15T12:43:00Z
Keywords
industry, pull, wrong-code
Assigned to
nobody
Creator
jcrapuchettes

Comments

Comment #0 by jcrapuchettes — 2013-10-14T17:22:51Z
Running with D 2.063.2 the following code compiles and runs without any problems. Using git checkout 4a2fabf, the code compiles, but segfaults when trav.empty() is called. Possible changes to the code that will allow it to run correctly are noted in the comments. struct S { //works if the class is moved out of the struct class InnerClass //works if final is added { S s; //works if removed bool empty() { return true; } } } void main() { S.InnerClass trav = new S.InnerClass(); trav.empty(); }
Comment #1 by k.hara.pg — 2013-10-15T07:45:16Z
Comment #2 by github-bugzilla — 2013-10-15T12:31:56Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0d930c9e9e0ad45dbcd5d876ff9ef66ae5d1c4b7 fix Issue 11265 - Segfault while calling instance method of class defined inside struct The regression was introduced by the commit: https://github.com/D-Programming-Language/dmd/commit/671b7c20b96b580ee1dc2b3f5e3ee66c63d079b6#diff-43282ebf5a2de5fdbcb3b5083ddf949dR147 vtbl[] calculation is essentially unrelated to the class instance size. So, just only once initializing of vtbl[] and running semantic on member functions is sufficient. https://github.com/D-Programming-Language/dmd/commit/a95bbf4642e349fffea5a567157a4599ceb96ab9 Merge pull request #2670 from 9rnsr/fix11265 [REG2.064a] Issue 11265 - Segfault while calling instance method of class defined inside struct
Comment #3 by github-bugzilla — 2013-10-15T12:34:45Z
Commit pushed to 2.064 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d1d46c7c31ec497ff7f09e178cf357ba7369aad4 Merge pull request #2670 from 9rnsr/fix11265 [REG2.064a] Issue 11265 - Segfault while calling instance method of class defined inside struct