Walter Bright:
> But why? Just use: 
>     foo(10);

I think you are missing something important here.

Static asserts (or other implicit errors) inside a template, etc, test that 
some input types are correct, some template input values are in the correct 
range, etc.

In this thread we are talking about unittests. The purpose of a unit Inside a 
unit test is to test that something that can be called Foo works as specified. 
Working as specified means such Foo must return the correct outputs when the 
inputs are in its intended range of possible inputs (otherwise the unittest has 
to fail), and it must produce a compile time assert, run time assert, or throw 
an exception if the input values are outside the allowed ones (otherwise the 
unittest has to fail again).

So the purpose of the feature I am talking here is for the group of those 
unittests, to make sure something asserts at compile time (or otherwise doesn't 
compile) when the compile-time inputs are wrong.

So I need something that inside the unittest asserts at compile time if Foo 
does not asserts at compile-time (or otherwise refuses to work).

Bye,
bearophile

Reply via email to