Bug 10804 – regression(2.063=>2.064) problem with Appender or dmd?

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-11T18:13:00Z
Last change time
2013-08-15T23:22:06Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
thelastmammoth

Comments

Comment #0 by thelastmammoth — 2013-08-11T18:13:04Z
on 2.063, behavior is normal, but on 2.064 this passes: (see "weird" below) (on v2.064-devel-75f7752) string identity(string a){ return a; } string fun(){ import std.array; Appender!(string) ret; ret.put("identity(`Ω`)"); return ret.data; } void main(){ enum a1="identity(`Ω`)"; enum a2=fun; assert(a1==a2); assert(mixin(a1)!=mixin(a2));//weird enum a1b=mixin(a1); enum a2b=mixin(a2); assert(cast(ubyte[])a1b == [206, 169]); assert(cast(ubyte[])a2b == [195, 142, 194, 169]); }
Comment #1 by k.hara.pg — 2013-08-13T05:08:37Z
This regression is caused by recent Appender change: https://github.com/D-Programming-Language/phobos/commit/4da1639c98cb73d07858b17c2d225063889e4700 , but essentialy this is a dmd bug. Reduced case: string identity(string a) { return a; } string fun() { char[] s; s.length = 14; s[0 .. 14] = "identity(`Ω`)"[]; return cast(string)s; } void main() { enum a1 = "identity(`Ω`)"; enum a2 = fun(); // fun() returns a string which originally mutable array static assert(cast(ubyte[])mixin(a1) == [0xCE, 0xA9]); static assert(cast(ubyte[])mixin(a2) == [0xCE, 0xA9]); // fails! }
Comment #2 by k.hara.pg — 2013-08-13T05:09:06Z
Comment #3 by github-bugzilla — 2013-08-15T23:21:53Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d6e9ea0fc6b906c829344806bb89c14d92bf48d7 fix Issue 10804 - regression(2.063=>2.064) problem with Appender or dmd? https://github.com/D-Programming-Language/dmd/commit/28f2c8c6c4e82392ff4aa366cf872bef45ee4f75 Merge pull request #2473 from 9rnsr/fix10804 [REG2.064a] Issue 10804 - problem with Appender or dmd?