From 917a48cd6522fb7f41b675a12f5c73d005ccbd79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 7 May 2009 16:05:07 +0200 Subject: [PATCH] templates: don't expand forward declarations for templates --- src/tokenize.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tokenize.cpp b/src/tokenize.cpp index 1a65688d0..4f262cbd9 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -474,7 +474,21 @@ void Tokenizer::simplifyTemplates() for (Token *tok = _tokens; tok; tok = tok->next()) { if (Token::simpleMatch(tok, "template <")) - templates.push_back(tok); + { + for (const Token *tok2 = tok; tok2; tok2 = tok2->next()) + { + // Just a declaration => ignore this + if (tok2->str() == ";") + break; + + // Implementation => add to "templates" + if (tok2->str() == "{") + { + templates.push_back(tok); + break; + } + } + } } if (templates.empty()) return;