the code
struct test
{
private real value;
this(real value)
{
this.value = value;
}
bool opUnary(string op)() if (op == "!")
{
return !value;
}
}
void main()
{
test a = 123.12345;
bool b = !a;
}
Compilation error
prog.d(19): Error: expression a of type test does not have a boolean value
http://ideone.com/Kec81
Also tested by dmd 2.053, 2.054
What is wrong with my code?
source
share