D-Programming-Language/dmd — pull request #522 by donc (2011-11-23 03:16:36+00:00)
Title: CTFE improved error handling + ref param bug 6934

Unfortunately this pull request is a bit complicated because one bug (6934) involved multiple problems.

There are two parts in this pull request.
(1) a cleanup to the CTFE backtraces.
In the backtrace for both CTFE and templates, it was writing directly to stderr.
I added a new error message type "errorSupplemental" to standardize this.
I made progress to fixing 6984 "CTFE generates a torrent of spurious errors, if there was a previous error" by improving the CTFE error handling in funcDeclaration::interpret and CallExp, and a improved error handling in static assert.

(2) initial refcounting for aggregate types (string, array, AA, and struct literals)
I had to do this to fix the serious bug 6934. It also gives a minor improvement to speed and memory consumption, even though it never releases any memory.

Bugs fixed:
6934 [CTFE] can't use $ in a slice of an array passed by ref
6964 Error message with __error: static assert(undefined+1)
6985 [CTFE] Non-constant case expressions can't be interpreted

Also mitigates bug 6933 from segfault without line number, into rejects-valid.