Previously, it seems like cppcheck had an issue where an uninitvar error was raised when using braced initialization of a class with new (https://trac.cppcheck.net/ticket/10698). This was later fixed in cppcheck 2.8. However, it seems that this issue still persists in cppcheck 2.9 if the class being initialized is referenced using scope resolution. Here is a minimal case of the issue that I will also attach:
#include<tuple>namespacefoo{classbar{};}classfoobar{};autotest(){foo::bar*inst1=newfoo::bar{};// cppcheck 2.9 flags this as an uninitialized variablefoo::bar*inst2=newfoo::bar;// OKfoo::bar*inst3=newfoo::bar();// OKfoobar*inst4=newfoobar{};// OKfoobar*inst5=newfoobar;// OKfoobar*inst6=newfoobar();// OKreturnstd::make_tuple(inst1,inst2,inst3,inst4,inst5,inst6);}intmain(){test();return0;}
Cppcheck 2.9 will flag inst1 as an uninitialized variable.
Previously, it seems like cppcheck had an issue where an uninitvar error was raised when using braced initialization of a class with new (https://trac.cppcheck.net/ticket/10698). This was later fixed in cppcheck 2.8. However, it seems that this issue still persists in cppcheck 2.9 if the class being initialized is referenced using scope resolution. Here is a minimal case of the issue that I will also attach:
Cppcheck 2.9 will flag
inst1
as an uninitialized variable.Have you checked with head? Seems like the problem has been fixed already.
Sorry for the late reply. I checked the issue on head and it has been fixed. Thank you.