From a85eacc15728a36976bf40a4a1c94e73223b42fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 18 Oct 2016 22:56:33 +0200 Subject: [PATCH] cstyleCast: don't warn about '(const Variable *)nullptr' --- lib/checkother.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index a7ce1c753..f8ef4ab03 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -282,7 +282,8 @@ void CheckOther::warningOldStylePointerCast() if (tok->strAt(3) == "const") tok = tok->next(); - if (tok->strAt(4) == "0") // Casting nullpointers is safe + const Token *p = tok->tokAt(4); + if (p->hasKnownIntValue() && p->values.front().intvalue==0) // Casting nullpointers is safe continue; // Is "type" a class?