[Issue 3231] Function declared to return a type with its same name doesn't compile
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 9 09:38:28 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3231
Stewart Gordon <smjg at iname.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |spec
--- Comment #13 from Stewart Gordon <smjg at iname.com> 2009-08-09 09:38:26 PDT ---
I think comment 3 pretty much covers it, but is this stated in the spec?
FTR here are two closely related examples that fail:
----- overload_scope_1.d -----
void func(int i) {}
class C {
static {
void func() {}
void func(string s) {}
void test() {
func();
func(42); // line 9
func("test");
}
}
}
----------
overload_scope_1.d(9): Error: function overload_scope_1.C.func () does not
match parameter types (int)
overload_scope_1.d(9): Error: cannot implicitly convert expression (42) of type
int to immutable(char)[]
overload_scope_1.d(9): Error: cannot cast int to immutable(char)[]
----- overload_scope_2.d -----
import overload_scope_2a;
import overload_scope_2b;
Qwert yuiop;
----- overload_scope_2a.d -----
alias string Qwert;
----- overload_scope_2b.d -----
void Qwert() {}
----------
overload_scope_2.d(4): Error: overload_scope_2a.Qwert at overload_scope_2a.d(1)
conflicts with overload_scope_2b.Qwert at overload_scope_2b.d(1)
----------
(DMD 2.031 Win; messages essentially the same in DMD 1.046.)
These cases show that it's down to two things:
- overload sets apply only between imported modules, not between scoping levels
- in any case, they apply only between function overloads, not between
arbitrarily mixed entity types
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list