www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4211] New: struct with annotation( safe)

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

           Summary: struct with annotation( safe)
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: zan77137 nifty.com



 safe struct X
{
    void func() {  }
}

 safe class Y
{
    void func() {  }
}

 safe void main()
{
    X x;
    x.func(); // NG
    auto y = new Y;
    y.func(); // OK
}

Is this a bug?

I like the behavior of class.
I think that struct/union should change the behavior.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4211


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



It's a bug.

This works:


struct Foo {
     safe void func() {  }
}
 safe void main() {
    Foo f;
    f.func();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4211


Walter Bright <bugzilla digitalmars.com> changed:

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



13:03:18 PST ---
*** This issue has been marked as a duplicate of issue 5110 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 05 2010