D-Programming-Language/dmd — pull request #1398 by AndrejMitrovic (2012-12-22 19:44:05+00:00)
Title: Issue 3969 - Add diagnostic error messages for invalid operator string specs

http://d.puremagic.com/issues/show_bug.cgi?id=3969

**Don't pull this yet.**

An initial implementation is provided. There are probably ways to improve this and to ensure it works in all possible cases. I'd like to know if there's a more optimal way of doing string comparisons (I do miss D's string switch statements).

Note of a special case: this will issue an error regardless of opEquals already being defined:

```D
struct S
{
bool opBinary(string op : "==")(const ref S s) { return true; } ; // error
bool opEquals(const ref S s) { return true; } ;
}
```

So I'm not sure if always issuing an error is acceptable. We could also consider using warnings initially and then changing them to errors at a later date.