diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-05-27 07:22:40 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-05-27 07:15:40 +0000 |
commit | 9224255f13952e5b4092208c8cae1a31ab5c6a19 (patch) | |
tree | a9707ab8b5d78731408cf7360ead1d3fb172f876 /src/corelib/tools | |
parent | 5fe16358bbbcd1a6fdd4904b01ffcec4a9eee5d8 (diff) |
QVector: silence clang warning about memmove
Also made a small comment fix
Task-number: QTBUG-53605
Change-Id: Ica9a06fe7a70f92f2a19a6df3ffdeaf1985e2eb6
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qvector.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index fea50f4c34..b68ca87063 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -736,7 +736,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend) const int itemsUntouched = abegin - d->begin(); // FIXME we could do a proper realloc, which copy constructs only needed data. - // FIXME we ara about to delete data maybe it is good time to shrink? + // FIXME we are about to delete data - maybe it is good time to shrink? // FIXME the shrink is also an issue in removeLast, that is just a copy + reduce of this. if (d->alloc) { detach(); @@ -756,7 +756,11 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend) } } else { destruct(abegin, aend); - memmove(abegin, aend, (d->size - itemsToErase - itemsUntouched) * sizeof(T)); + // QTBUG-53605: static_cast<void *> masks clang errors of the form + // error: destination for this 'memmove' call is a pointer to class containing a dynamic class + // FIXME maybe use std::is_polymorphic (as soon as allowed) to avoid the memmove + memmove(static_cast<void *>(abegin), static_cast<void *>(aend), + (d->size - itemsToErase - itemsUntouched) * sizeof(T)); } d->size -= itemsToErase; } |