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

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


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



--- Comment #2 from monarchdodra at gmail.com 2013-09-02 11:57:56 PDT ---
I think the "root" issue is that when the enum is first instantiated, the
compiler doesn't care what the "marked" type of the enum is, but rather, what
the actual (ctfe) memory points to.

//----
module test;

char[] cc()
{
    return cast(char[])"hello";
}

string ss()
{
    return cast(string)['a', 'b'];
}

void main()
{
    auto cc1 = cc; //*Should* duplicate
    auto cc2 = cc; //*Should* duplicate
    auto ss1 = ss; //Should *not* duplicate
    auto ss2 = ss; //Should *not* duplicate
    assert(cc1 !is cc2); //Failed to duplicate
    assert(ss1  is ss2); //Failed to not duplicate
}
//----

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