diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-07-24 18:46:37 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-07-27 14:16:37 (GMT) |
commit | b2261de3937e7574b4d17b055f685878c33ec319 (patch) | |
tree | 6acb4512ef1f8f5cf404d10b405d8c8da94e8529 | |
parent | f120b5e4b63cbc30874fa21947b75d352f18d7df (diff) | |
download | Qt-b2261de3937e7574b4d17b055f685878c33ec319.zip Qt-b2261de3937e7574b4d17b055f685878c33ec319.tar.gz Qt-b2261de3937e7574b4d17b055f685878c33ec319.tar.bz2 |
Work around a Sun CC 5.9 compiler bug: the threadEngine variable isn't found.
QtConcurrent had the following code:
template <typename T> class ThreadEngineStarterBase
{ ...
protected:
ThreadEngine<T> *threadEngine;
};
template <typename T>
class ThreadEngineStarter : public ThreadEngineStarterBase<T>
{
public:
ThreadEngineStarter(ThreadEngine<T> *threadEngine)
:ThreadEngineStarterBase<T>(threadEngine) {}
[...]
};
The Sun CC compiler simply didn't parse the parameter declaration in
the constructor. Instead of complaining, it silently ignored the
problem. Which meant that the constructor simply used the
uninitialised member variable from the base class to call the parent
constructor, which ended up initialised with itself.
You'd think that it's just because the parameter has the same name as
a member variable. But it appears to be a compiler bug altogether. If
you change the name, then you start getting compile errors.
This change is a workaround that worked.
Reviewed-By: Bradley T. Hughes
-rw-r--r-- | src/corelib/concurrent/qtconcurrentthreadengine.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.h b/src/corelib/concurrent/qtconcurrentthreadengine.h index 1f359fc..2f610de 100644 --- a/src/corelib/concurrent/qtconcurrentthreadengine.h +++ b/src/corelib/concurrent/qtconcurrentthreadengine.h @@ -238,9 +238,11 @@ protected: template <typename T> class ThreadEngineStarter : public ThreadEngineStarterBase<T> { + typedef ThreadEngineStarterBase<T> Base; + typedef ThreadEngine<T> TypedThreadEngine; public: - ThreadEngineStarter(ThreadEngine<T> *threadEngine) - :ThreadEngineStarterBase<T>(threadEngine) {} + ThreadEngineStarter(TypedThreadEngine *eng) + : Base(eng) { } T startBlocking() { |