Thread overview
[Issue 4211] New: struct with annotation(@safe)
May 20, 2010
SHOO
Dec 05, 2010
Walter Bright
May 20, 2010
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


--- Comment #0 from SHOO <zan77137@nifty.com> 2010-05-20 05:47:44 PDT ---
@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
http://d.puremagic.com/issues/show_bug.cgi?id=4211


bearophile_hugs@eml.cc changed:

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


--- Comment #1 from bearophile_hugs@eml.cc 2010-05-20 09:24:06 PDT ---
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: -------
December 05, 2010
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


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2010-12-05 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: -------