我看到以下Cppcheck
,但不明白为什么得到它:
directoryutils.cpp 173 error returnReference false Reference to auto variable returned.
我既不明白为什么会返回auto
变量,也不清楚“参考部分”。那是假阳性吗?
标题:static const FilePerApplication &applicationDataDirectoryMapWithoutCurrentVersion();
const CDirectoryUtils::FilePerApplication &CDirectoryUtils::applicationDataDirectoryMapWithoutCurrentVersion()
{
static const FilePerApplication dirs = [ = ] {
FilePerApplication directories;
for (const QFileInfo &info : CDirectoryUtils::applicationDataDirectories())
{
.... fill in data ....
directories.insert(info.filePath(), appInfo);
}
return directories; // LINE 173 why auto???
}();
return dirs;
}
using FilePerApplication = QMap<QString, CApplicationInfo>;
-> FilePerApplication
不会使检查错误失效