www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10275] New: CTFE: Allow const casts of struct literals

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10275

           Summary: CTFE: Allow const casts of struct literals
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2013-06-05 07:05:36 PDT ---
This is allowed in const folding, but not in CTFE.
----------
struct Bug10275
{
    uint[] ivals;
}

Bug10275 bug10275() {
    return Bug10275([1,2,3]);
}

int test10275()
{
    immutable(Bug10275) xxx = cast(immutable(Bug10275))bug10275();
    return 1;
}

static assert(test10275());
----------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 05 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10275



--- Comment #1 from github-bugzilla puremagic.com 2013-06-24 23:32:32 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b92a1ff925c5194d714296dec177b92c70011c2c
Fix bug 10275 CTFE: allow const casts of struct literals

This was permitted in const-folding, but not in CTFE until now.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10275


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2013