Bug 4546 – D2 Language Docs: http://www.digitalmars.com/d/2.0/type.html

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-08-01T08:59:00Z
Last change time
2011-02-01T17:35:35Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2010-08-01T08:59:50Z
"Implicit Conversions" The last line is wrong, replace the example with: enum Foo { E } Foo f; int i; i = f; // OK f = i; // error f = cast(Foo)i; // OK f = 0; // error f = f.E; // OK "Delegates" In the example, a non-constructed class has it's member function assigned to a delegate. Also, the two functions have no body and this will make the linker spit out nonsense. Replace with: int func(int) { return 0; }; class OB { int member(int) { return 0; }; } void main() { int function(int) fp; // fp is pointer to a function int delegate(int) dg; // dg is a delegate to a function fp = &func; // fp points to func OB o = new OB; dg = &o.member; // dg is a delegate to object o and // member function member }
Comment #1 by andrej.mitrovich — 2011-02-01T17:35:35Z
First part: I've no idea what the "i" in the enum example is, it's not actually defined as an int on the website even though in the first comment I labeled it as int for some reason. Second part: Examples don't have to work, they're just demonstrating the syntax.