File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2887,7 +2887,8 @@ void CheckOther::checkRedundantCopy()
28872887 if (fScope && fScope ->bodyEnd && Token::Match (fScope ->bodyEnd ->tokAt (-3 ), " return %var% ;" )) {
28882888 const Token* varTok = fScope ->bodyEnd ->tokAt (-2 );
28892889 if (varTok->variable () && !varTok->variable ()->isGlobal () &&
2890- (!varTok->variable ()->type () || estimateSize (varTok->variable ()->type (), mSettings , symbolDatabase) > 2 * mSettings ->platform .sizeof_pointer ))
2890+ (!varTok->variable ()->type () || !varTok->variable ()->type ()->classScope ||
2891+ estimateSize (varTok->variable ()->type (), mSettings , symbolDatabase) > 2 * mSettings ->platform .sizeof_pointer ))
28912892 redundantCopyError (startTok, startTok->str ());
28922893 }
28932894 }
Original file line number Diff line number Diff line change @@ -580,3 +580,16 @@ namespace {
580580 Q_PROPERTY (QHash<QString, int > hash READ hash WRITE setHash)
581581 };
582582}
583+
584+ struct SEstimateSize {
585+ inline const QString& get () const { return m; }
586+ QString m;
587+ };
588+
589+ class QString ;
590+
591+ void dontCrashEstimateSize (const SEstimateSize& s) {
592+ // cppcheck-suppress redundantCopyLocalConst
593+ QString q = s.get ();
594+ if (!q.isNull ()) {}
595+ }
You can’t perform that action at this time.
0 commit comments