Skip to content

Commit

Permalink
tst_manualqdatastream: fix gcc error
Browse files Browse the repository at this point in the history
GCC has a bug [1] that does not allow to specialize templates
outside of a namespace.
An attempt to build the test results in the following error:

 tst_manualqdatastream.cpp:18:15: error: explicit specialization in
 non-namespace scope ‘class tst_QDataStream’

Fix it by converting the template specializations into simple function
overloads.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282

Pick-to: 6.7
Change-Id: I7803cce1687ca8ae992f1a57394346eb6fc90c8b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
  • Loading branch information
Ivan Solovev committed Jan 26, 2024
1 parent beebf64 commit b9c8c57
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions tests/manual/corelib/qdatastream/tst_manualqdatastream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ class tst_QDataStream : public QObject

template <class T>
void fill(T &input);
template <>

void fill(QSet<qsizetype> &input);
template <>
void fill(QMap<qsizetype, qsizetype> &input);
template <>
void fill(QHash<qsizetype, qsizetype> &input);

template <class T>
Expand Down Expand Up @@ -58,7 +56,6 @@ void tst_QDataStream::fill(T &input)
qDebug("Created dataset in %lld ms", timer.elapsed());
}

template <>
void tst_QDataStream::fill(QSet<qsizetype> &input)
{
constexpr qsizetype GiB = 1024 * 1024 * 1024;
Expand All @@ -76,7 +73,6 @@ void tst_QDataStream::fill(QSet<qsizetype> &input)
qDebug("Created dataset in %lld ms", timer.elapsed());
}

template <>
void tst_QDataStream::fill(QMap<qsizetype, qsizetype> &input)
{
constexpr qsizetype GiB = 1024 * 1024 * 1024;
Expand All @@ -93,7 +89,6 @@ void tst_QDataStream::fill(QMap<qsizetype, qsizetype> &input)
qDebug("Created dataset in %lld ms", timer.elapsed());
}

template <>
void tst_QDataStream::fill(QHash<qsizetype, qsizetype> &input)
{
constexpr qsizetype GiB = 1024 * 1024 * 1024;
Expand Down

0 comments on commit b9c8c57

Please sign in to comment.