Is this a bug? Code:

        import std.stdio;

        struct S {
                static int func(int x) { return x+1; }
                int func(int x) { return x+2; }
        }

        void main() {
                S s;
                writeln(s.func(1));
        }

DMD (latest git) output:

        test.d(10): Error: function test.S.func called with argument types:
                ((int))
        matches both:
                test.S.func(int x)
        and:
                test.S.func(int x)

The error message is unhelpful, but basically the complaint is that the
static method is conflicting with the non-static method.

But I would've thought it is unambiguous; I'd expect that s.func should
resolve to the non-static method, and S.func to the static method. After
all, no object is needed to invoke the static method, and the static
method cannot be invoked without an object.


T

-- 
The early bird gets the worm. Moral: ewww...

Reply via email to