Co-authored-by: Robert Reif <reif@FX6840>
This commit is contained in:
parent
be09361279
commit
da3eb2e411
|
@ -2548,6 +2548,9 @@ void CheckClass::checkDuplInheritedMembersRecursive(const Type* typeCurrent, con
|
|||
// Check if there is info about the 'Base' class
|
||||
if (!parentClassIt.type || !parentClassIt.type->classScope)
|
||||
continue;
|
||||
// Don't crash on recursive templates
|
||||
if (parentClassIt.type == typeBase)
|
||||
continue;
|
||||
// Check if they have a member variable in common
|
||||
for (const Variable &classVarIt : typeCurrent->classScope->varlist) {
|
||||
for (const Variable &parentClassVarIt : parentClassIt.type->classScope->varlist) {
|
||||
|
|
|
@ -575,6 +575,21 @@ private:
|
|||
checkDuplInheritedMembers("template<size_t N>\n"
|
||||
"struct BitInt : public BitInt<N+1> { };");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// don't crash on recursive template
|
||||
checkDuplInheritedMembers("namespace _impl {\n"
|
||||
" template <typename AlwaysVoid, typename>\n"
|
||||
" struct fn_traits;\n"
|
||||
"}\n"
|
||||
"template <typename T>\n"
|
||||
"struct function_traits\n"
|
||||
" : public _impl::fn_traits<void, std::remove_reference_t<T>> {};\n"
|
||||
"namespace _impl {\n"
|
||||
" template <typename T>\n"
|
||||
" struct fn_traits<decltype(void(&T::operator())), T>\n"
|
||||
" : public fn_traits<void, decltype(&T::operator())> {};\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void checkCopyConstructor(const char code[]) {
|
||||
|
|
Loading…
Reference in New Issue