operator "~" does not check type?

Jonathan M Davis jmdavisProg at gmx.com
Wed Oct 12 00:12:22 PDT 2011


On Wednesday, October 12, 2011 07:08:05 Cheng Wei wrote:
> The following expression compiles but does not make sense.
> 
> string str = "hello" ~ 10;
> assert(str == "hello\n");
> 
> Is this a useful feature or just a bug?

int and dchar implicitly convert to one another for better or for worse. 
Personally, I'd prefer that they didn't, but that's the way that it is, so I 
don't believe that this is technically a bug.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list