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?

Reply via email to