[Issue 13610] bringToFront does not work with CTFE

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Dec 6 19:28:44 PST 2014


https://issues.dlang.org/show_bug.cgi?id=13610

yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies at gmail.com
         Resolution|---                         |WONTFIX

--- Comment #3 from yebblies <yebblies at gmail.com> ---
(In reply to Don from comment #1)
> 
> Of course it fails. array is an enum, it can never change. That's the point
> of enum!
> 
> The confusing thing is that bringToFront compiles when passed a manifest
> constant.

The 'bug' is that you can have mutable array manifest constant.  The code
expands to:

bringToFront([1, 2, 3, 4][0 .. $-1], [1, 2, 3, 4][$-1 .. $]);

which is valid, because an array literal is a valid range.

The mutable manifest constant and implicit dup, are unfortunately working as
designed.

See issue 9953.

--


More information about the Digitalmars-d-bugs mailing list