www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8620] New: Possible circular reference

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

           Summary: Possible circular reference
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: moonburntm gmail.com



---code
import std.stdio;

struct itemType
{
     property double value() { return value; }

    this(double value)
    {
        this.itemValue = value;
    }

    private:
        double itemValue;
}

void main()
{
    itemType item = itemType(0.05);
    writeln(item.value); //this line fails
}
---

---compile
dmd code.d //Works fine
---

---run
code.exe //Segfault
---

Surely, this shouldn't compile, as the property is either trying to return
itself or it's somehow thinking there is a value variable which doesn't exist.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 04 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8620


Walter Bright <bugzilla digitalmars.com> changed:

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



23:07:19 PDT ---
There's no way the compiler can detect, in the general case, infinite recursion
at runtime.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 04 2012