There are a few things you have to understand. The compiler is really doing the best it can; it tells you exactly where it failed, and the entire compilation up until that point. It doesn't know what you intended to write, it knows what you wrote, so how can it possibly assume an error was caused by something else more remote? I think if you were writing it and got to the point of making errors "cleaner, shorter, and more friendly", you'd realize this is much more difficult that it might seem.
There are situations when it can do that, and compilers are getting better at suggesting them it seems. For example this:
if (x);
{
x = 5;
}
Produces a warning:
warning C4390: ';' : empty controlled statement found; is this the intent?
But they can't always do that.
That all said, the error messages are really all you need to solve the problem, once you learn the language a bit and understand what it all means. I think it's an enormous myth and exaggeration that template errors are "evil and cryptic". While they can be verbose, they're really not that hard to understand at all. I don't think it's template errors being cryptic, I think it's the reader not knowing how to read it well, which makes it seem cryptic. But if you take your time, you see exactly what it was trying to do and where it failed.
There were a thing called "concepts" that would appear in the next standard, C++0x, that would fix this up immensely. They were sort of like tags that classes could fit into if they supported everything that tag said they had to. So in std::copy
, instead of errors about being unable to call operator=
on something, along with the errors that propagates, you would simply get something like "Error: Type is not CopyAssignable" and that would be it. Same error, different presentation. And that's also the reason they got cut out, for now. they were proving to be trouble, and since it was syntactic sugar anyway, it's more important to work on other things. Hopefully we'll see them someday.
Now, there is a tool called STLFilt, which will filter template errors concerning things in the STL. I have never used it, but I've heard it recommended more than once. Here's one of their sample filters. You might give it a try.
Since you seem to think this is something possible to do in the language itself: nope. The language has no concepts of what errors messages should look like or what should warn or what shouldn't.
You'll find what I mean in the standard in section 1.4/2. Summarized, it basically says "If there's an error, output something about it". That's it.