Jonathan M Davis <> changed:

           What    |Removed                     |Added
                 CC|                            |
          Component|Phobos                      |DMD

--- Comment #1 from Jonathan M Davis <> 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

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

Reply via email to