[Issue 12269] Unittest within template struct scope is not executed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 28 04:28:11 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12269


Vladimir Panteleev <thecybershadow at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |thecybershadow at gmail.com
         Resolution|                            |INVALID


--- Comment #6 from Vladimir Panteleev <thecybershadow at gmail.com> 2014-02-28 14:28:09 EET ---
This is a clearly invalid issue.

The compiler can't execute the unit test because it can't POSSIBLY know what to
instantiate the template with. It's like asking someone to verify that a
mathematical equation is sound, but leaving half of the variables as blanks.

The compiler will generate a unit test for every unique instantiation of the
template. This way, the unit test will effectively test every combination of
parameters - out of those used in your program. There is no problem and no need
to restructure any code, as long as you build your entire program with the
-unittest switch, as opposed to separate modules that only contain template
declarations without instantiating them.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list