www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12798] New: constant folding should optimize subsequent

https://issues.dlang.org/show_bug.cgi?id=12798

          Issue ID: 12798
           Summary: constant folding should optimize subsequent
                    concatenations
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: performance
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

This is front-end optimizer issue.

Preceding concatenations of string literals will be optimized to one long
literal.

string x;

string y = "a" ~ "b" ~ x;   // optimized to "ab" ~ x

But subsequent one doesn't.

string z = x ~ "a" ~ "b";   // not optimized to x ~ "ab"

--
May 24 2014