digitalmars.D - can we get error messages from __traits(compiles)?
"Adam D. Ruppe" <destructionator gmail.com> writes:
static assert(isInputRange!T) tells us when T doesn't match the range interface, but doesn't tell us why. Trying to instantiate a function that uses the range will tell us why it didn't compile, but puts the error in the using function instead of at the object. My thought is we could improve things with something like this: auto error = __traits(compileErrorMessage, useRange!T); static assert(error is null, error); Then, the static assert will fail at the location of the object instead of in library code, but the message will show what went wrong with instantiating the library. Any other ideas to achieve this? If no, can we capture the error message like this?
Mar 07 2014
Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 3/7/14, Adam D. Ruppe <destructionator gmail.com> wrote:auto error = __traits(compileErrorMessage, useRange!T); static assert(error is null, error);https://d.puremagic.com/issues/show_bug.cgi?id=8992 I closed it until more people wanted the feature. Guess we could reopen it?
Mar 07 2014