Thread overview
No code coverage for templated classes / methods?
Jul 22, 2007
Matthias Walter
Jul 22, 2007
Sean Kelly
Jul 22, 2007
novice2
Jul 23, 2007
Sean Kelly
July 22, 2007
Hello,

sorry for reposting this but I got no answer some time ago:

I've implemented an algorithm in D, using templates to achieve different precisions (32bit, 64bit and arbitrary precision using GMP in the future). Sadly, code coverage does not work for those (I've used Digital Mars D Compiler v1.014) - all lines in the templated classes don't count as lines with executable code :( Is it possible to change this behavior?

Any ideas whether I'm doing something wrong or this is not possible at all?

best regards
Matthias Walter
July 22, 2007
Matthias Walter wrote:
> Hello,
> 
> sorry for reposting this but I got no answer some time ago:
> 
> I've implemented an algorithm in D, using templates to achieve different
> precisions (32bit, 64bit and arbitrary precision using GMP in the future).
> Sadly, code coverage does not work for those (I've used Digital Mars D Compiler
> v1.014) - all lines in the templated classes don't count as lines with
> executable code :( Is it possible to change this behavior?

If I had to guess, I would say this is related to the fact that template code cannot be debugged at the moment either.  It's likely that certain debug information isn't currently being generated for template code.

> Any ideas whether I'm doing something wrong or this is not possible at all?

It's possible, just likely not supported yet.


Sean
July 22, 2007
sorry for offtopic.
btw, is there any method to see D code, generated by templates?
July 23, 2007
novice2 wrote:
> sorry for offtopic.
> btw, is there any method to see D code, generated by templates?

Not that I know of.


Sean
July 25, 2007
Sean Kelly wrote:

> novice2 wrote:
>> sorry for offtopic.
>> btw, is there any method to see D code, generated by templates?
> 
> Not that I know of.

pragma(msg, ...), the typeinfo functions and .stringof may or may not help. Especially nested metastuff is a bit messy right now. Debugging string mixins is easier.