In C and C++ all expressions are essentially evaluated down to a logical expression: true or false? true is any non-zero value while false is zero.
What's happening is that your expression
if(passMin(val), minval)
is falling foul of the ,
operator, which evaluates the expression on the left side and discards the result, then proceeds to evaluate the expression on the right and return that value.
The comma operator has the lowest precedence of any operator and is left associative.
Essentially, the code above means
void(passMin(val));
if (minVal)
It's very unlikely that any current compiler provides an option to restrict this pattern, because it is very widely used for things like pointer and zero checks:
for (Node* node = list->head; node; node = node->next)
...
void func(const char* str) {
assert(str);
...
So if you did have an option you would probably cripple most libraries, STL, boost, etc.
That said, you could probably use a static analyzer to enforce a code practice that prohibits it within your own code.
Visual studio: http://msdn.microsoft.com/en-us/library/dd380660.aspx
Clang static analyzer: http://clang-analyzer.llvm.org/ (the page is not all that helpful, the analyzer seems to come with 3.5 so additional searches will be required to find better documentation)