Skip to content

Commit 951567b

Browse files
Fix #14583 FP duplInheritedMember for uninstantiated template (#8326)
1 parent 6496273 commit 951567b

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

lib/checkclass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,6 +3127,8 @@ static std::vector<DuplMemberFuncInfo> getDuplInheritedMemberFunctionsRecursive(
31273127
continue;
31283128
if (classFuncIt.tokenDef->isExpandedMacro())
31293129
continue;
3130+
if (classFuncIt.templateDef)
3131+
continue;
31303132
for (const Function& parentClassFuncIt : parentClassIt.type->classScope->functionList) {
31313133
if (classFuncIt.name() == parentClassFuncIt.name() &&
31323134
(parentClassFuncIt.access != AccessControl::Private || !skipPrivate) &&

test/testclass.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,13 @@ class TestClass : public TestFixture {
734734
" void Two() = delete;\n"
735735
"};\n");
736736
ASSERT_EQUALS("", errout_str());
737+
738+
checkDuplInheritedMembers("struct B { void f(); };\n" // #14583
739+
"struct D : B {\n"
740+
" template <typename>\n"
741+
" void f();\n"
742+
"};\n");
743+
ASSERT_EQUALS("", errout_str());
737744
}
738745

739746
#define checkCopyConstructor(...) checkCopyConstructor_( __FILE__, __LINE__, __VA_ARGS__)

0 commit comments

Comments
 (0)