[Issue 5373] Regression (2.051) CTFE and std.string.replace() causes "Bad binary function q{a == b}..

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 3 15:02:34 PST 2011


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



--- Comment #5 from Rob Jacques <sandford at jhu.edu> 2011-02-03 15:00:16 PST ---
This is the patch from Issue 5406. It appear to solve both issue's test cases.

template binaryFunImpl(alias fun, string parm1Name, string parm2Name) {
    static if (is(typeof(fun) : string)) {
        enum testAsExpression = "{ ElementType1 "
            ~parm1Name~"; ElementType2 "
            ~parm2Name~"; return ("~fun~");}()";

        typeof(mixin(testAsExpression))
        result(ElementType1, ElementType2)(ElementType1 __a, ElementType2 __b)
            if(__traits(compiles, mixin(testAsExpression)))
        {
            mixin("alias __a "~parm1Name~";");
            mixin("alias __b "~parm2Name~";");
            mixin("return (" ~ fun ~ ");");
        }
    } else {
        alias fun result;
    }
}

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