Programming for std.log

Jose Armando Garcia jsancio at gmail.com
Sun Feb 12 13:43:47 PST 2012


On Sun, Feb 12, 2012 at 6:25 PM, Adam D. Ruppe
<destructionator at gmail.com> wrote:
> On Sunday, 12 February 2012 at 20:18:13 UTC, Jose Armando Garcia wrote:
>>
>> Is there anyway that dmd can tell me why a template is being
>> instantiated? Something like like:
>
>
> You do get that if a static assert fails. One of the first
> things I do when I update dmd is to hack up the source
> to a bunch of phobos to do something like
>
> if(!__traits(compiles, instantiation_here))
>  static assert(0);

Very helpful advice! I narrowed it down to:

$ cat format_spec.d
import std.format;
void main() {
  static assert(is(Unqual!char == char));
  FormatSpec!char spec;
}

 ../dmd/src/dmd -w format_spec.d
format_spec.d(4): Error: static assert  (is(Unqual!(char) == char)) is false

This is suppose to be true, no?

Thanks,
-Jose

>
> just because that error message is infinitely more helpful.
>
>
> I don't know about the std.algorithm one, but I do this
> in std.conv a lot and it is good there because there's
> a to!() entry point that then calls toImpl, and the to!()
> one can be easily static asserted.


More information about the Digitalmars-d mailing list