Hi,

Why compilation depends on order of method declarations?

The following test case does not compile.

However, if we change the order of the 'read' methods in class InputStream below then compilation will not fail.

Is it a bug?

---
module test;

import std.traits : isBasicType;
import std.typetuple : TypeTuple;

class InputStream {

    long read( ubyte* bytes, long len )
    {
        return 0;
    }

    void read(T)( ref T val ) if (isBasicType!T)
    {
        read(cast(ubyte*)&val, cast(long)val.sizeof);
    }

}

void main()
{
    auto input = new InputStream;

    foreach (T; TypeTuple!(long, int, short, byte))
    {
        T v;
        input.read(v);
    }
}
---

Thanks.

Reply via email to