http://d.puremagic.com/issues/show_bug.cgi?id=8709
Jonathan M Davis <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Component|Phobos |DMD --- Comment #1 from Jonathan M Davis <[email protected]> 2012-09-23 03:40:50 PDT --- Reduced test case: struct S { alias value this; string value; } void main () { auto s = S("hello"); char[] arr = "world".dup; s = cast(S)"other"; s = cast(S)arr; } The cast from string to S works, but the cast from char[] to S does not, in spite of the fact that their only difference is constness. However, the fact that this came up with std.string.toLower just highlights how error-prone it is to use alias this with templated functions. It's insanely easy to have template constraints which pass just fine due to the presense of alias this but then fail to actually compile or which behave bizarrely due to when conversions do and don't happen. I don't know what the solution to that is though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
