From 0fe4249cfc516da5e1b91575199e0e034b525f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 20 Nov 2010 17:20:25 +0100 Subject: [PATCH] Fixed #2216 (wrong warning when C++0x keyword delete is used) --- lib/tokenize.cpp | 2 +- test/testtokenize.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 3bce12c26..1528056b8 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2106,7 +2106,7 @@ bool Tokenizer::tokenize(std::istream &code, tok2 = tok2->link()->previous(); // operator ==|>|<|.. - if (Token::Match(tok->previous(), "operator %any%")) + if (Token::Match(tok2->previous(), "operator %any%")) tok2 = tok2->previous(); else if (Token::simpleMatch(tok2->tokAt(-2), "operator [ ]")) tok2 = tok2->tokAt(-2); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index d043352f9..48378deef 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -4282,6 +4282,13 @@ private: ASSERT_EQUALS("struct A { }", tokenizeAndStringify(code)); } + { + const char *code = "struct A {" + " void operator = (void *) = delete;" + "}"; + ASSERT_EQUALS("struct A { }", tokenizeAndStringify(code)); + } + { const char *code = "struct foo {" " foo();"