[Issue 5406] [patch] Major regressions in std.algorithm for functions relying on is(typeof(binaryFun!... due to a static assert in binaryFunImpl
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 3 09:48:30 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5406
--- Comment #2 from Rob Jacques <sandford at jhu.edu> 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:
Body!(dchar,const(char)[])
C:\dmd2\src\phobos\std\algorithm.d(2149): instantiated from here:
result!(dchar,const(char)[])
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")~")
This2Algebraic;");
doesn't.
Although I don't know how/why find is called.
--
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