the following test program produces a cppcheckError error with the for line, but no error with the if nor the 3rd lines.
#include<chrono>usingnamespacestd::chrono_literals;voidf(void){autow=10ms;for(boolf=true;f;)w=200ms;// cppcheckError// if ( true ) w = 200ms; // no error// w = 200ms; // no error}
Tested on Ubuntu 22.04 with cppcheck 2.12 dev (48a7a43ef2fbd112c071485eef8a1eb2b806266e of Mon Sep 4 20:05:17 2023 +0200), using the command line:
--std=c++17
The 3 forms compile with g++ 11.4.0.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
the following test program produces a cppcheckError error with the for line, but no error with the if nor the 3rd lines.
Tested on Ubuntu 22.04 with cppcheck 2.12 dev (48a7a43ef2fbd112c071485eef8a1eb2b806266e of Mon Sep 4 20:05:17 2023 +0200), using the command line:
The 3 forms compile with g++ 11.4.0.
See https://trac.cppcheck.net/ticket/11438
Thanks