digitalmars.D.bugs - static overloaded method with parent overload
- Sark7 (21/21) Jun 21 2004 Class access to static overloaded method do not works.
- Ilya Zaitseff (17/38) Jul 17 2004 DMD 0.95 still have this bug:
- Andrew Edwards (10/58) Jul 17 2004 I'm learning here so maybe I've got this all wrong, but isn't one
- Ilya Zaitseff (11/38) Jul 18 2004 No, because foo() is static, i.e. it is member of type, not type instanc...
Class access to static overloaded method do not works. <code> class A { static void bar(int x) {} } class B: A { alias A.bar bar; static void bar(char[] x) {} } void main() { B b = new B(); b.bar(1); // ok b.bar("1"); // ok B.bar(1); // error: function expected before (), not 'bar' B.bar("1"); // error: function expected before (), not 'bar' } </code> Mixins have that bug too.
Jun 21 2004
DMD 0.95 still have this bug: <code> template TA() { static void foo(int i) { } } struct B { mixin TA!() ta; alias ta.foo foo; static void foo(int i, int j) { } } void main() { B.foo(1); // error: function expected before (), not 'foo' } </code>Class access to static overloaded method do not works. <code> class A { static void bar(int x) {} } class B: A { alias A.bar bar; static void bar(char[] x) {} } void main() { B b = new B(); b.bar(1); // ok b.bar("1"); // ok B.bar(1); // error: function expected before (), not 'bar' B.bar("1"); // error: function expected before (), not 'bar' } </code> Mixins have that bug too.
Jul 17 2004
Ilya Zaitseff wrote:DMD 0.95 still have this bug: <code> template TA() { static void foo(int i) { } } struct B { mixin TA!() ta; alias ta.foo foo; static void foo(int i, int j) { } } void main() { B.foo(1); // error: function expected before (), not 'foo' } </code>I'm learning here so maybe I've got this all wrong, but isn't one supposed to instantiate a struct prior to accessing it's members? shouldn't your main read this instead? void main() { B b; b.foo(1); } Just a thought!Class access to static overloaded method do not works. <code> class A { static void bar(int x) {} } class B: A { alias A.bar bar; static void bar(char[] x) {} } void main() { B b = new B(); b.bar(1); // ok b.bar("1"); // ok B.bar(1); // error: function expected before (), not 'bar' B.bar("1"); // error: function expected before (), not 'bar' } </code> Mixins have that bug too.
Jul 17 2004
Ilya Zaitseff wrote:No, because foo() is static, i.e. it is member of type, not type instance. The following compiles successfully: struct B { static void foo(int i) {} } void main() { B.foo(1); } The problem in mixins itself.DMD 0.95 still have this bug: <code> template TA() { static void foo(int i) { } } struct B { mixin TA!() ta; alias ta.foo foo; static void foo(int i) { } } void main() { B.foo(1); // error: function expected before (), not 'foo' } </code>I'm learning here so maybe I've got this all wrong, but isn't one supposed to instantiate a struct prior to accessing it's members? shouldn't your main read this instead? void main() { B b; b.foo(1); } Just a thought!
Jul 18 2004