Silence bogus MSVC warning about variable not used

The compiler is wrong: the variable was used in the previous line.
However, the line had no effect for a type T that has a trivial
destructor, so the optimizer must have discarded the line and the
reference to the variable before the checker for used variables.

qsharedpointer_impl.h(247) : warning C4189: 'that' : local variable is initialized but not referenced

Change-Id: Ia0aac2f09e9245339951ffff13c8bde02bb46816
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Thiago Macieira 2015-03-05 15:27:32 -08:00
parent 8972ceea87
commit 84b9d07163
1 changed files with 1 additions and 0 deletions

View File

@ -247,6 +247,7 @@ namespace QtSharedPointer {
ExternalRefCountWithContiguousData *that =
static_cast<ExternalRefCountWithContiguousData *>(self);
that->data.~T();
Q_UNUSED(that); // MSVC warns if T has a trivial destructor
}
static void safetyCheckDeleter(ExternalRefCountData *self)
{