While tinkering with some code I eventually found that the following didn't do as I expected

import std.conv;
import std.stdio;

void main()
{
    Foo foo = 5;
    writeln(foo);
}

struct Foo{
    int i;
    alias i this;
    @disable T opCast(T)();
    this(int j)
    {i =j;}
}

If the cast in the example is implict this code compiles and executes.
If the cast is explicit it doesn't.
Is there a plan to expose something like 'opImplCast()()' so I can @disable it for some types where I absolutely don't want any accidental type conversions?
Shouldn't this just be a feature of D?

Reply via email to