Thread overview | ||||||
---|---|---|---|---|---|---|
|
March 01, 2011 [Issue 5671] New: CTFE string concat problem | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@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: ------- |
March 01, 2011 [Issue 5671] CTFE string concat problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=5671 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au --- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-03-01 05:08:35 PST --- Reduced test case shows it is a constant folding problem. ['a', 'b'] ~ "c" doesn't get constant folded. string foo5671() { return ['a', 'b']; } string bug5671() { return foo5671() ~ "c"; } static assert(bug5671() == "abc"); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 06, 2011 [Issue 5671] CTFE string concat problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=5671 --- Comment #2 from Don <clugdbug@yahoo.com.au> 2011-03-05 17:56:46 PST --- Can be reduced even further, showing CTFE isn't involved at all: static assert( ['a', 'b'] ~ "c" == "abc" ); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 18, 2011 [Issue 5671] CTFE string concat problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=5671 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2011-04-18 16:02:31 PDT --- https://github.com/D-Programming-Language/dmd/commit/316ba0a77e3934bfc8091940444f706e82aecc72 https://github.com/D-Programming-Language/dmd/commit/5c7c6b51e27d9cd394ddda4f7940cdf9c1610953 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation