From 324257ef52376ed0bfa4e70a675191af710c24ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 5 Nov 2017 17:59:34 +0100 Subject: [PATCH] Fixed #7823 (No varid for member variable of type std::bitset< static_cast(2) >) --- lib/templatesimplifier.cpp | 5 ++--- test/testvarid.cpp | 9 +++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 9c8ae6218..85db792fa 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -314,9 +314,8 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok) } tok = tok->next(); - // * / & - while (Token::Match(tok, "[*&]")) - tok = tok->next(); + if (Token::simpleMatch(tok,"(")) + tok = tok->link()->next(); if (!tok) return 0; diff --git a/test/testvarid.cpp b/test/testvarid.cpp index 6c08b2a49..445503c69 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -99,6 +99,7 @@ private: TEST_CASE(varidFunctionCall4); // ticket #3280 TEST_CASE(varidFunctionCall5); TEST_CASE(varidStl); + TEST_CASE(varidStl2); TEST_CASE(varid_newauto); // not declaration: new const auto(0); TEST_CASE(varid_delete); TEST_CASE(varid_functions); @@ -1157,6 +1158,14 @@ private: ASSERT_EQUALS(expected, actual); } + void varidStl2() { + const std::string actual = tokenize("std::bitset(2)> x;"); + + const char expected[] = "1: std :: bitset < static_cast < int > ( 2 ) > x@1 ;\n"; + + ASSERT_EQUALS(expected, actual); + } + void varid_newauto() { ASSERT_EQUALS("1: void f ( ) { const new auto ( 0 ) ; }\n", tokenize("void f(){new const auto(0);}"));