11-10-2024, 02:41 PM
The later, it should be treated as non-compliant. In effect you've got an object of type C being converted to bool, even if it does go through extra steps.
if (c.operator()) ;
or
if ( c ); // if C declared operator bool();
would both be compliant.
if (c.operator()) ;
or
if ( c ); // if C declared operator bool();
would both be compliant.
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group