From fcb756e42ab48fe3b9ea66b8e8af1e5913bb264d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 18 Mar 2013 10:50:07 +0100 Subject: [PATCH 1/2] Revert "GCC 4.6 compatibility: can't list-initialize array of classes." It does too much harm on GCC 4.6 (all these constexpr constructors are not constexpr now). We can disable that `-pedantic` warning for GCC 4.6 only and live with that. This reverts commit 2d92d497d9a1b20c9ff83e386b58745955204d54. --- src/Math/RectangularMatrix.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/Math/RectangularMatrix.h b/src/Math/RectangularMatrix.h index 8fa5ac663..fb869992d 100644 --- a/src/Math/RectangularMatrix.h +++ b/src/Math/RectangularMatrix.h @@ -106,12 +106,7 @@ template class RectangularMatrix { * * @todo Creating matrix from arbitrary combination of matrices with n rows */ - #ifndef CORRADE_GCC46_COMPATIBILITY template inline constexpr /*implicit*/ RectangularMatrix(const Vector& first, const U&... next): _data{first, next...} { - #else - template inline /*implicit*/ RectangularMatrix(const Vector& first, const U&... next): _data() { - constructInternal({first, next...}); - #endif static_assert(sizeof...(next)+1 == cols, "Improper number of arguments passed to RectangularMatrix constructor"); } @@ -448,21 +443,7 @@ template class RectangularMatrix { private: /* Implementation for RectangularMatrix::RectangularMatrix(const RectangularMatrix&) */ - #ifndef CORRADE_GCC46_COMPATIBILITY template inline constexpr explicit RectangularMatrix(Implementation::Sequence, const RectangularMatrix& matrix): _data{Vector(matrix[sequence])...} {} - #else - template inline constexpr explicit RectangularMatrix(Implementation::Sequence, const RectangularMatrix& matrix): _data() { - constructInternal({Vector(matrix[sequence])...}); - } - #endif - - #ifdef CORRADE_GCC46_COMPATIBILITY - /* GCC < 4.7 workaround for a ton of warnings / "error: bad array initializer" */ - inline void constructInternal(std::initializer_list> data) { - for(std::size_t i = 0; i != data.size(); ++i) - _data[i] = *(data.begin() + i); - } - #endif Vector _data[cols]; }; From 66a3f1177d382d444a975f4736421ee65e7f1d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 18 Mar 2013 11:04:04 +0100 Subject: [PATCH 2/2] GCC 4.6 compatibility: disable `-pedantic` warning. The compiler doesn't like list-initialization of array of classes (RectangularMatrix constructors). It is perfectly legal C++11 and both GCC 4.7 and Clang accept it without notice. --- src/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 704b6d1a2..c5c733f48 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,6 +22,13 @@ # DEALINGS IN THE SOFTWARE. # +# Disable `-pedantic` for GCC 4.6, as the compiler doesn't like +# list-initialization of array of classes (RectangularMatrix constructors). It +# is perfectly legal C++11 and both GCC 4.7 and Clang accept it without notice. +if(CORRADE_GCC46_COMPATIBILITY) + string(REPLACE "-pedantic" "" CORRADE_CXX_FLAGS "${CORRADE_CXX_FLAGS}") +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}") include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CORRADE_INCLUDE_DIR})