July 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8380

           Summary: -unittest makes it so that std.replace doesn't work on
                    enums
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: jmdavisProg@gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-12 01:42:55 PDT ---
This code compiles just fine normally:

import std.array;
import std.stdio;

void main()
{
    enum str = q{writeln("hellojoeworld");};
    mixin(replace(str, "joe", " "));
}


but if you compile with -unittest, you get this error

/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/array.d(1453): Error:
template std.array.replace(E,R1,R2) if (isDynamicArray!(E[]) &&
isForwardRange!(R1) && isForwardRange!(R2) && (hasLength!(R2) ||
isSomeString!(R2))) forward reference to template replace(E,R1,R2) if
(isDynamicArray!(E[]) && isForwardRange!(R1) && isForwardRange!(R2) &&
(hasLength!(R2) || isSomeString!(R2)))
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/array.d(1453): Error:
template std.array.replace(E,R1,R2) if (isDynamicArray!(E[]) &&
isForwardRange!(R1) && isForwardRange!(R2) && (hasLength!(R2) ||
isSomeString!(R2))) cannot deduce template function from argument types
!()(string,string,string)
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/algorithm.d(414): Error:
inout on return means inout must be on a parameter as well for inout(uint)()
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/algorithm.d(479): Error:
template instance
std.algorithm.DummyRange!(cast(ReturnBy)0,cast(Length)0,cast(RangeType)2) error
instantiating
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/algorithm.d(414): Error:
inout on return means inout must be on a parameter as well for inout(uint)()
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/algorithm.d(480): Error:
template instance
std.algorithm.DummyRange!(cast(ReturnBy)0,cast(Length)0,cast(RangeType)3) error
instantiating
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/algorithm.d(414): Error:
inout on return means inout must be on a parameter as well for inout(uint)()
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/algorithm.d(482): Error:
template instance
std.algorithm.DummyRange!(cast(ReturnBy)0,cast(Length)1,cast(RangeType)2) error
instantiating


This is particularly annoying, because it makes it impossible to use replace on strings at compile time to strip out newlines before mixing them in (to avoid screwing up the line numbers).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8380


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID
            Summary|-unittest makes it so that  |-unittest makes it so that
                   |std.replace doesn't work in |std.replace doesn't work on
                   |CTFE                        |enums


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-07-12 01:47:38 PDT ---
Scratch this. Apparently some local changes I had caused this.

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