Bug 15590 – 0 coverage should be ignored in __ctfe branches

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-01-22T09:22:24Z
Last change time
2020-06-17T01:59:42Z
Assigned to
No Owner
Creator
Basile-z

Comments

Comment #0 by b2.temp — 2016-01-22T09:22:24Z
compile & run with -cov -unittest -main |auto foo() |{ 1| if(__ctfe) 0000000| return 1; | else 1| return 0; |} | |unittest |{ | static assert(foo()); 1| assert(!foo()); |} /home/basile/Bureau/temp/a.d is 75% covered The process returns 0, meaning that the __ctfe branch has returned 1 and that consequently the static assertion is correct, however coverage does not detect it. The problem is that because of this a module with __ctfe branches and static assertions can't reach 100% coverage.
Comment #1 by b2.temp — 2016-02-28T12:20:45Z
Since coverage is generated by the target application, it cannot know if the compiler has run it.
Comment #2 by b2.temp — 2020-06-17T01:59:42Z
*** This issue has been marked as a duplicate of issue 20931 ***