D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10804 - regression(2.063=>2.064) problem with Appender or dmd?
Summary: regression(2.063=>2.064) problem with Appender or dmd?
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: pull, wrong-code
Depends on:
Blocks:
 
Reported: 2013-08-11 18:13 UTC by thelastmammoth
Modified: 2013-08-15 23:22 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description thelastmammoth 2013-08-11 18:13:04 UTC
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 Kenji Hara 2013-08-13 05:08:37 UTC
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 3 github-bugzilla 2013-08-15 23:21:53 UTC
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?