Bug 4561 – D2 Language Docs: http://www.digitalmars.com/d/2.0/function.html

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-08-01T14:48:00Z
Last change time
2012-11-29T13:29:07Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2010-08-01T14:48:02Z
"Function Inheritance and Overriding" The 4th example is trying to import std.hiddenfunc. The compiler can't find that file (I'm guessing this was moved someplace else). This will need updating. "Overload Sets" There are three code example modules here: module A; void foo() { } void foo(long i) { } module B; class C { } void foo(C) { } void foo(int i) { } import A; import B; void bar(C c) { foo(); // calls A.foo() foo(1L); // calls A.foo(long) foo(c); // calls B.foo(C) foo(1,2); // error, does not match any foo foo(1); // error, matches A.foo(long) and B.foo(int) A.foo(1); // calls A.foo(long) } I am getting an additional error on line: foo(1L); error: new.d(7): Error: B.foo at B.d(4) conflicts with A.foo at A.d(3) a.foo(long) and b.foo(int) conflict when passing long as an argument. But seeing as calling them with an int will conflict as well, I expect this to be the normal behavior. If that is so, change that line to: foo(1L); // error, matches A.foo(long) and B.foo(int) Title: "Typesafe variadic functions" In the third example, change these lines: Foo g = new Foo(3, "abc"); test(1, 4, "def"); to: Foo g = new Foo(3, "abc".dup); test(1, 4, "def".dup); for the example to compile. "Local Variables" "It is an error to use a local variable without first assigning it a value." This sounds like C semantics to me. But D has all of its local variables initialized to their default values, so I'm not sure what this statement means. "It is an error to declare a local variable that is never referred to." I've never had such an error and neither a warning. Can someone elaborate?
Comment #1 by andrej.mitrovich — 2012-11-29T13:29:07Z
These have been fixed in other bug reports.