fix crash in checkclass from unknown template valueType (#3129)
This commit is contained in:
parent
1eafed9e75
commit
75e439e56d
|
@ -74,7 +74,9 @@ static const char * getFunctionTypeName(Function::Type type)
|
|||
|
||||
static bool isVariableCopyNeeded(const Variable &var)
|
||||
{
|
||||
return var.isPointer() || (var.type() && var.type()->needInitialization == Type::NeedInitialization::True) || (var.valueType()->type >= ValueType::Type::CHAR);
|
||||
return var.isPointer() ||
|
||||
(var.type() && var.type()->needInitialization == Type::NeedInitialization::True) ||
|
||||
(var.valueType() && var.valueType()->type >= ValueType::Type::CHAR);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -196,6 +196,8 @@ private:
|
|||
TEST_CASE(uninitComparisonAssignment); // ticket #7429
|
||||
|
||||
TEST_CASE(uninitTemplate1); // ticket #7372
|
||||
|
||||
TEST_CASE(unknownTemplateType);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3903,6 +3905,18 @@ private:
|
|||
"A<B<T1, T2>>::A() : m_value(false) {}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void unknownTemplateType() {
|
||||
check("template <typename T> class A {\n"
|
||||
"private:\n"
|
||||
" T m;\n"
|
||||
"public:\n"
|
||||
" A& operator=() { return *this; }\n"
|
||||
"};\n"
|
||||
"A<decltype(SOMETHING)> a;");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestConstructors)
|
||||
|
|
Loading…
Reference in New Issue