test[0u] of type bool[1u] does not have a boolean value

monarch_dodra monarchdodra at gmail.com
Sat Jun 29 06:11:06 PDT 2013


On Saturday, 29 June 2013 at 12:57:07 UTC, Namespace wrote:
> I get this with -wi:
> bug.d(5): Warning: explicit element-wise assignment 
> (test[0u])[] = false is bett
> er than test[0u] = false
>
> That helps a bit. But I thought that D dereferences 
> automatically? ;)

Only when making a function call (AFAIK), eg: "p.foo();"

This also takes precedence over UFCS:

----
struct S
{
     void foo(){writeln("val");}
}
void foo(S*){writeln("pointer");} //troll function trying to 
hijack p.foo()
void main()
{
     S* p = new S;
     p.foo();
}
--------
val
--------


More information about the Digitalmars-d-learn mailing list