[Issue 5671] New: CTFE string concat problem

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 1 04:59:12 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5671

           Summary: CTFE string concat problem
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-03-01 04:56:19 PST ---
A problem found by Peter Lundgren and David Nadlinger.

Reduced D2 code:


import std.conv: to;
string foo() {
    // return to!string(10); // OK
    return to!string(10) ~ "";
}
string s = foo();
void main() {}


DMD 2.052 gives the errors:
test.d(4): Error: to(10) ~ "" cannot be interpreted at compile time
test.d(6): Error: cannot evaluate foo() at compile time
test.d(6): Error: cannot evaluate foo() at compile time


I think it's not a problem of to!() because this alternative version works
correctly:


import std.conv: to;
string foo() {
    return to!string(10);
}
string s = foo();
void main() {}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list