From 199428864f52595b0fc090d2ba5e35dbef7531be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 4 Jan 2014 01:39:48 +0100 Subject: [PATCH] GCC 4.5 compatibility: inherited move semantics somehow doesn't work. We need to explicitly delete copy constructors (otherwise std::is_constructible::value is true) and add passthrough move constructors. WHY. --- src/BufferTexture.h | 10 ++++++++ src/CubeMapTexture.h | 10 ++++++++ src/CubeMapTextureArray.h | 10 ++++++++ src/Query.h | 30 ++++++++++++++++++++++++ src/Test/AbstractShaderProgramGLTest.cpp | 10 ++++++++ src/Texture.h | 10 ++++++++ 6 files changed, 80 insertions(+) diff --git a/src/BufferTexture.h b/src/BufferTexture.h index a322d649b..c432a970c 100644 --- a/src/BufferTexture.h +++ b/src/BufferTexture.h @@ -217,6 +217,16 @@ class MAGNUM_EXPORT BufferTexture: private AbstractTexture { explicit BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {} + #ifdef CORRADE_GCC45_COMPATIBILITY + BufferTexture(const BufferTexture&) = delete; + BufferTexture(BufferTexture&& other) = default; + BufferTexture& operator=(const BufferTexture&) = delete; + BufferTexture& operator=(BufferTexture&& other) { + AbstractTexture::operator=(std::move(other)); + return *this; + } + #endif + /** @copydoc AbstractTexture::id() */ Int id() const { return AbstractTexture::id(); } diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index 80eb4f3b3..05caec7aa 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -96,6 +96,16 @@ class CubeMapTexture: public AbstractTexture { */ explicit CubeMapTexture(): AbstractTexture(GL_TEXTURE_CUBE_MAP) {} + #ifdef CORRADE_GCC45_COMPATIBILITY + CubeMapTexture(const CubeMapTexture&) = delete; + CubeMapTexture(CubeMapTexture&&) = default; + CubeMapTexture& operator=(CubeMapTexture&) = delete; + CubeMapTexture& operator=(CubeMapTexture&& other) { + AbstractTexture::operator=(std::move(other)); + return *this; + } + #endif + /** * @brief Set wrapping * diff --git a/src/CubeMapTextureArray.h b/src/CubeMapTextureArray.h index b89cf6b02..35a6da895 100644 --- a/src/CubeMapTextureArray.h +++ b/src/CubeMapTextureArray.h @@ -87,6 +87,16 @@ class CubeMapTextureArray: public AbstractTexture { */ explicit CubeMapTextureArray(): AbstractTexture(GL_TEXTURE_CUBE_MAP_ARRAY) {} + #ifdef CORRADE_GCC45_COMPATIBILITY + CubeMapTextureArray(const CubeMapTextureArray&) = delete; + CubeMapTextureArray(CubeMapTextureArray&&) = default; + CubeMapTextureArray& operator=(const CubeMapTextureArray&) = delete; + CubeMapTextureArray& operator=(CubeMapTextureArray&& other) { + AbstractTexture::operator=(std::move(other)); + return *this; + } + #endif + /** * @brief Set wrapping * diff --git a/src/Query.h b/src/Query.h index 3e97e4e6c..f98abea50 100644 --- a/src/Query.h +++ b/src/Query.h @@ -194,6 +194,16 @@ class PrimitiveQuery: public AbstractQuery { explicit PrimitiveQuery() {} + #ifdef CORRADE_GCC45_COMPATIBILITY + PrimitiveQuery(const PrimitiveQuery&) = delete; + PrimitiveQuery(PrimitiveQuery&&) = default; + PrimitiveQuery& operator=(const PrimitiveQuery&) = delete; + PrimitiveQuery& operator=(PrimitiveQuery&& other) { + AbstractQuery::operator=(std::move(other)); + return *this; + } + #endif + /** * @brief Begin query * @@ -322,6 +332,16 @@ class SampleQuery: public AbstractQuery { explicit SampleQuery() {} + #ifdef CORRADE_GCC45_COMPATIBILITY + SampleQuery(const SampleQuery&) = delete; + SampleQuery(SampleQuery&&) = default; + SampleQuery& operator=(const SampleQuery&) = delete; + SampleQuery& operator=(SampleQuery&& other) { + AbstractQuery::operator=(std::move(other)); + return *this; + } + #endif + /** @copydoc PrimitiveQuery::begin() */ void begin(Target target) { AbstractQuery::begin(GLenum(target)); @@ -408,6 +428,16 @@ class TimeQuery: public AbstractQuery { explicit TimeQuery() {} + #ifdef CORRADE_GCC45_COMPATIBILITY + TimeQuery(const TimeQuery&) = delete; + TimeQuery(TimeQuery&&) = default; + TimeQuery& operator=(const TimeQuery&) = delete; + TimeQuery& operator=(TimeQuery&& other) { + AbstractQuery::operator=(std::move(other)); + return *this; + } + #endif + /** * @brief Query timestamp * diff --git a/src/Test/AbstractShaderProgramGLTest.cpp b/src/Test/AbstractShaderProgramGLTest.cpp index 277da9a82..cf637171a 100644 --- a/src/Test/AbstractShaderProgramGLTest.cpp +++ b/src/Test/AbstractShaderProgramGLTest.cpp @@ -53,6 +53,16 @@ namespace { class MyShader: public AbstractShaderProgram { public: explicit MyShader() {} + + #ifdef CORRADE_GCC45_COMPATIBILITY + MyShader(const MyShader&) = delete; + MyShader(MyShader&&) = default; + MyShader& operator=(const MyShader&) = delete; + MyShader& operator=(MyShader&& other) { + AbstractShaderProgram::operator=(std::move(other)); + return *this; + } + #endif }; } diff --git a/src/Texture.h b/src/Texture.h index b7aa34608..8bd063a01 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -229,6 +229,16 @@ template class Texture: public AbstractTexture { */ explicit Texture(Target target = DataHelper::target()): AbstractTexture(GLenum(target)) {} + #ifdef CORRADE_GCC45_COMPATIBILITY + Texture(const Texture&) = delete; + Texture(Texture&&) = default; + Texture& operator=(const Texture&) = delete; + Texture& operator=(Texture&& other) { + AbstractTexture::operator=(std::move(other)); + return *this; + } + #endif + /** @brief %Texture target */ constexpr Target target() const { return static_cast(_target); }