https://issues.dlang.org/show_bug.cgi?id=16397
--- Comment #4 from Martin Nowak <[email protected]> --- Comment from Rainer https://github.com/dlang/phobos/pull/5579#issuecomment-313905465 > Always generating coverage instrumentation of templated code will only work > if > you cover all linked libraries, though. For example, coverage from > druntime > modules might leak into the report, just as well as that it might provide > template instances without coverage instrumention. Yes, but that's what we do with everything else as well, e.g. -unittest or -profile, so it seems sensible to use this here as well. That's also what C++ and gcov do. ---- cat > cova.cc << CODE #include "covb.h" int main() { foo<int>(1, 2); } CODE cat > covb.h << CODE template <typename T> T foo(T a, T b) { return a + b; } CODE g++ -fprofile-arcs -ftest-coverage cova.cc -o cova ./cova gcov cova.cc ---- File 'covb.h' Lines executed:100.00% of 2 Creating 'covb.h.gcov' File 'cova.cc' Lines executed:100.00% of 3 Creating 'cova.cc.gcov' ---- --
