On Fri, 20 Nov 2015 20:39:57 +0000, Ilya wrote:

> Can DMD frontend optimize
>   string concatenation
> ```
> enum Double(S) = S ~ S;
> 
> assert(condition, "Text " ~ Double!"+" ~ ___FUNCTION__);
> ```
> 
> to
> 
> ```
> assert(condition, "Text ++_function_name_");
> 
> ```
> ?

Yes this occurs as part of the constant folding I believe.

$ cat test.d
enum Double(string S) = S ~ S;
void main(string[] args){
        assert(args.length, "Text " ~ Double!"+" ~ __FUNCTION__);
}

$ dmd test.d
$ strings test | grep Text
Text ++test.main

Reply via email to