www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11265] New: Segfault while calling instance method of class defined inside struct

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11265

           Summary: Segfault while calling instance method of class
                    defined inside struct
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jcrapuchettes gmail.com



17:22:51 PDT ---
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();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 14 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11265


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, wrong-code



https://github.com/D-Programming-Language/dmd/pull/2670

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 15 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11265




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


[REG2.064a] Issue 11265 - Segfault while calling instance method of class
defined inside struct

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 15 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11265




Commit pushed to 2.064 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d1d46c7c31ec497ff7f09e178cf357ba7369aad4


[REG2.064a] Issue 11265 - Segfault while calling instance method of class
defined inside struct

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 15 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11265


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 15 2013