[Issue 10950] [CTFE] enum "char[]" not correctly duplicated when used.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 2 11:51:19 PDT 2013


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



--- Comment #1 from monarchdodra at gmail.com 2013-09-02 11:51:17 PDT ---
(In reply to comment #0)
Or, the contrary:

//----
import std.exception;

enum string s = assumeUnique(['a', 'b']);

void main()
{
  auto s1 = s;
  auto s2 = s;
  assert (s1.ptr == s2.ptr); //Fails;
}
//----

We are hitting this in this pull:
https://github.com/D-Programming-Language/phobos/pull/1540

The "problem" seems to be reduced to:


//----
module test;

import std.array;

string toStr()
{
    auto w = appender!string();
    w.put('1');
    return w.data;
}

void main()
{
    enum string s = toStr();
    string s1 = s;
    string s2 = s;
    assert(s1 == s2);
    assert(s1.ptr is s2.ptr); //HERE
}
//----

This used to pass in 2.063.2, but fails in 2.064ALPHA.

I don't want to say it's a regression, just noticing the behavior changed.

-- 
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