10
10
11
11
#include " BaseMembersFinalizer.hpp"
12
12
#include < mrdocs/Support/Report.hpp>
13
+ #include < mrdocs/Support/Algorithm.hpp>
13
14
14
15
namespace clang ::mrdocs {
15
16
@@ -101,12 +102,19 @@ inheritBaseMembers(
101
102
for (SymbolID const & otherID: base)
102
103
{
103
104
// Find the info from the base class
104
- auto idIt = std::ranges::find (derived, otherID);
105
- MRDOCS_CHECK_OR_CONTINUE (idIt == derived.end ());
105
+ MRDOCS_CHECK_OR_CONTINUE (!contains (derived, otherID));
106
106
Info* otherInfoPtr = corpus_.find (otherID);
107
107
MRDOCS_CHECK_OR_CONTINUE (otherInfoPtr);
108
108
Info& otherInfo = *otherInfoPtr;
109
109
110
+ // Check if we're not attempt to copy a special member function
111
+ if (auto const * funcPtr = static_cast <FunctionInfo const *>(otherInfoPtr))
112
+ {
113
+ MRDOCS_CHECK_OR_CONTINUE (!is_one_of (
114
+ funcPtr->Class ,
115
+ { FunctionClass::Constructor, FunctionClass::Destructor }));
116
+ }
117
+
110
118
// Check if derived class has a member that shadows the base member
111
119
auto shadowIt = std::ranges::find_if (
112
120
derived,
@@ -126,12 +134,9 @@ inheritBaseMembers(
126
134
std::tie (func.Name , func.Params , func.Template ) ==
127
135
std::tie (otherFunc.Name , otherFunc.Params , func.Template );
128
136
}
129
- else
130
- {
131
- // For other kinds of members, it's a shadow if the names
132
- // are the same
133
- return info.Name == otherInfo.Name ;
134
- }
137
+ // For other kinds of members, it's a shadow if the names
138
+ // are the same
139
+ return info.Name == otherInfo.Name ;
135
140
});
136
141
MRDOCS_CHECK_OR_CONTINUE (shadowIt == derived.end ());
137
142
0 commit comments