http://d.puremagic.com/issues/show_bug.cgi?id=5373
Summary: Regression (2.051) CTFE and std.string.replace() causes "Bad binary function q{a == b}.. Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: soul...@gmail.com --- Comment #0 from Heywood Floyd <soul...@gmail.com> 2010-12-24 21:31:04 PST --- Using replace() in a mixin doesn't seem to work if the mixin is placed inside a class. (I have no idea what's going on here.) Isolated example: // - - - - 8< - - - - - - - - - - - - import std.stdio, std.string; version(bug) { class Foo { mixin(anint("a")); this() { a = 9; } } } void main() { version(bug) { auto a = new Foo; writeln("a:", a.a); } else //works { mixin(anint("a")); a = 9; writeln("a:",a); } } string anint(string name) { return replace("int $name;", "$name", name); } // - - - - 8< - - - - - - - - - - - - # dmd -run testmixin.d a:9 # dmd -version=bug -run testmixin.d /Library/Compilers/dmd2/osx/bin/../../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)[]." /Library/Compilers/dmd2/osx/bin/../../src/phobos/std/functional.d(180): instantiated from here: Body!(dchar,const(char)[]) /Library/Compilers/dmd2/osx/bin/../../src/phobos/std/algorithm.d(2149): instantiated from here: result!(dchar,const(char)[]) # _ // - - - - 8< - - - - - - - - - - - - I'm pretty sure this worked in 2.050, or at least 2.049. (Some program I'm working on started emitting these errors today. Didn't before. Not entirely sure when I last built it. Sorry.) BR /HF -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------