Bug 4211 – struct with annotation(@safe)

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-05-20T05:47:00Z
Last change time
2014-02-15T02:43:12Z
Assigned to
nobody
Creator
zan77137

Comments

Comment #0 by zan77137 — 2010-05-20T05:47:44Z
@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.
Comment #1 by bearophile_hugs — 2010-05-20T09:24:06Z
It's a bug. This works: struct Foo { @safe void func() { } } @safe void main() { Foo f; f.func(); }
Comment #2 by bugzilla — 2010-12-05T13:03:18Z
*** This issue has been marked as a duplicate of issue 5110 ***