This commit is contained in:
parent
ca20152e51
commit
73d305ea46
|
@ -248,7 +248,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
|
|||
continue;
|
||||
|
||||
// funcname ( => Assert that the end parentheses isn't followed by {
|
||||
if (Token::Match(funcname, "%name% (|<")) {
|
||||
if (Token::Match(funcname, "%name% (|<") && funcname->linkAt(1)) {
|
||||
const Token *ftok = funcname->next();
|
||||
if (ftok->str() == "<")
|
||||
ftok = ftok->link();
|
||||
|
|
|
@ -52,6 +52,7 @@ private:
|
|||
TEST_CASE(template7); // #9766 crash
|
||||
TEST_CASE(template8);
|
||||
TEST_CASE(template9);
|
||||
TEST_CASE(template10);
|
||||
TEST_CASE(throwIsNotAFunction);
|
||||
TEST_CASE(unusedError);
|
||||
TEST_CASE(unusedMain);
|
||||
|
@ -358,6 +359,15 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void template10() {
|
||||
check("template<typename T>\n" // #12013, don't crash
|
||||
"struct S {\n"
|
||||
" static const int digits = std::numeric_limits<T>::digits;\n"
|
||||
" using type = std::conditional<digits < 32, std::int32_t, std::int64_t>::type;\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void throwIsNotAFunction() {
|
||||
check("struct A {void f() const throw () {}}; int main() {A a; a.f();}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
|
Loading…
Reference in New Issue