"Daniel Keep" <[email protected]> wrote in message news:[email protected]... > > > Christopher Wright wrote: >> Don wrote: >>> [snip] >>> >>> Then we get: >>> static assert(__traits(mixincompiles, comp), "Predicate: " ~ comp ~ " >>> does not compile"); >>> >>> mxin(comp); >> >> That's certainly prettier. > > Still doesn't give the user a reason for WHY their predicate didn't > compile... > > It's a pity we can't do this (or something similar): > > template Something(string comp) > { > static assert( __traits(mixincompiles, comp), > "Predicate q{"~comp~"} does not compile, because:\n" > ~__traits(mixinerrors, comp, > Something.instantiationFile, > Something.instantiationLine) ); > } > > -- Daniel
I'd much rather see errors and static asserts inside of a template cause the compiler to automatically output a template instantiation "stack trace" (for lack of a better term). Ie, list files/lines starting with the deepest file/line, and then the file/line that instantiated that template, and if that was also inside a template, then the file/line that instantiated that, etc.
