Consider this code:

class Test {
  void Test::test() {}
};

which compiles without warnings on msvc but is not standard conforming (requires gcc -fpermissive).
One gets the following error with cppcheck:

example.cpp:2:22: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn]
  void Test::test() {}
                     ^

which is wrong because the return type is void

 

Last edit: Leander Schulten 2025-05-21