--- Comment #2 from Rob Jacques <> 2011-02-03 09:46:11 PST ---
I apologize for the bad test case. In retrospect, I believe I didn't try to
reduce it, I simply extrapolated the issue from the error message reported.
Here is a properly test case:

import std.string;
pragma(msg, replace(int.stringof,"int","real"));

Which generates the error:

C:\dmd2\src\phobos\std\functional.d(177): Error: static assert  "Bad binary
function q{a == b}. You need to use a valid D expression using symbols a of
type dchar and b of type const(char)[]."
C:\dmd2\src\phobos\std\functional.d(180):        instantiated from here:
C:\dmd2\src\phobos\std\algorithm.d(2149):        instantiated from here:

What got me was that algorithm.d(2149) turns out to be:

2147: R find(alias pred = "a == b", R, E)(R haystack, E needle)
2148: if (isInputRange!R &&
2149:         is(typeof(binaryFun!pred(haystack.front, needle)) : bool))

However, this only seems to generate a bug in certain compile-time contexts.
For example, enum bug = replace(int.stringof,"int","real"); compiles, while:
import std.typetuple;
mixin( "alias TypeTuple!("~replace(int.stringof,"int","real")~")

Although I don't know how/why find is called.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to