www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9318] New: stack overflow if struct have alias this to this.init and has function,in which compare itself with init

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

           Summary: stack overflow if struct have alias this to this.init
                    and has function,in which compare itself with init
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: zheny list.ru



import std.stdio;

struct Bar
{
    bool checkState()
    {
        return this == Bar.init;//if comment it all right
    }
    static  property Bar m_init()
    {
        return Bar.init;
    }
    alias m_init this;
}

void main()
{
}

This fails to compile with message "Stack overflow"

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



This is a problem with self-recursive alias this.

*** This issue has been marked as a duplicate of issue 7437 ***

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