diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-11-10 08:49:33 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-11-10 09:04:20 +0000 |
commit | 2f9ad6283b888495a8536cccf6fdad7d85dd78b0 (patch) | |
tree | 160f7356f32e28ab7448ead9281d1cbcb6471f95 | |
parent | 4ea3fcec20fdd80ae71cd69039e0ecae0a40653e (diff) |
shiboken6: Fix inheriting template fields
562edc619787d83b2d4418fa7a69c597a7b6945c changing
AbstractMetaClass::fields() to return const-ref
introduced a bug causing inherited fields of the same name
to be rejected since they were added to the list.
Take a copy of the field list to fix this,
similar to d72f0e35f22f3f9460d12e40f8f5676bf5a7f0d1
for functions.
Change-Id: I4c7c4938dc4b3515a51ed0a161b4fc8c95d4f141
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r-- | sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp index f7c7f1292..96316b128 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp @@ -2709,14 +2709,15 @@ void AbstractMetaBuilderPrivate::inheritTemplateFunctions(AbstractMetaClass *sub subclass->addFunction(f.take()); } - const AbstractMetaFieldList &subClassFields = subclass->fields(); + // Take copy + const AbstractMetaFieldList existingSubclassFields = subclass->fields(); const AbstractMetaFieldList &templateClassFields = templateClass->fields(); for (const AbstractMetaField *field : templateClassFields) { // If the field is modified or the instantiation has a field named // the same as an existing field we have shadowing, so we need to skip it. if (field->isModifiedRemoved(TypeSystem::All) || field->attributes().testFlag(AbstractMetaAttributes::Static) - || AbstractMetaField::find(subClassFields, field->name()) != nullptr) { + || AbstractMetaField::find(existingSubclassFields, field->name()) != nullptr) { continue; } |