QTextCodec: try to work around an ICC 19 bug

ICC 19 barfs on the TextCodecsMutexLocker class because it doesn't
have a user-provided default ctor:

  ../../corelib/codecs/qtextcodec.cpp(543): error #854: const variable locker requires an initializer -- class TextCodecsMutexLocker has no user-provided default constructor
  [...]

But the class doesn't have members that would delete the
implictly-declared default ctor, so no user-provided default ctor
should be necessary:

The only member is the result of qt_unique_lock(), which is
std::unique_lock, which does have a default ctor.

We conclude that this is a compiler bug, and work around it with the
introduction of a user-provided default ctor.

Fix brace placement as a drive-by.

Fixes: QTBUG-78844
Change-Id: I1f5a326afd68138fbebad506ba9aa1926f1afb85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2019-10-07 05:30:54 +02:00
parent a2e718a71a
commit a6ffdbe30c

View File

@ -103,10 +103,13 @@ typedef QList<QByteArray>::ConstIterator ByteArrayListConstIt;
Q_GLOBAL_STATIC(QRecursiveMutex, textCodecsMutex);
class TextCodecsMutexLocker {
class TextCodecsMutexLocker
{
using Lock = decltype(qt_unique_lock(std::declval<QRecursiveMutex&>()));
// ### FIXME: this is used when textCodecsMutex already == nullptr
const Lock lock = qt_unique_lock(textCodecsMutex());
public:
TextCodecsMutexLocker() {} // required d/t an ICC 19 bug
};
#if !QT_CONFIG(icu)