diff --git a/src/Magnum/Array.h b/src/Magnum/Array.h index 0532958fc..0644bebef 100644 --- a/src/Magnum/Array.h +++ b/src/Magnum/Array.h @@ -77,11 +77,7 @@ template class Array { constexpr /*implicit*/ Array(T value); #else template::value && dimensions != 1, T>::type> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - /*implicit*/ Array(U value): Array(typename Math::Implementation::GenerateSequence::Type(), value) {} + constexpr /*implicit*/ Array(U value): Array(typename Math::Implementation::GenerateSequence::Type(), value) {} #endif /** @brief Equality */ diff --git a/src/Magnum/ImageView.h b/src/Magnum/ImageView.h index 6290e6a44..8eebe93d6 100644 --- a/src/Magnum/ImageView.h +++ b/src/Magnum/ImageView.h @@ -108,11 +108,7 @@ template class ImageView { /** @overload * Similar to the above, but uses default @ref PixelStorage parameters. */ - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor& size) noexcept: ImageView{{}, format, type, size} {} + constexpr explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor& size) noexcept: ImageView{{}, format, type, size} {} /** @brief Storage of pixel data */ PixelStorage storage() const { return _storage; } @@ -241,11 +237,7 @@ template class CompressedImageView { * Similar the above, but uses default @ref CompressedPixelStorage * parameters (or the hardcoded ones in OpenGL ES and WebGL). */ - #if !defined(CORRADE_MSVC2015_COMPATIBILITY) || defined(MAGNUM_TARGET_GLES) - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit CompressedImageView(CompressedPixelFormat format, const VectorTypeFor& size, Containers::ArrayView data) noexcept; + constexpr explicit CompressedImageView(CompressedPixelFormat format, const VectorTypeFor& size, Containers::ArrayView data) noexcept; #ifndef MAGNUM_TARGET_GLES /** @@ -364,12 +356,7 @@ template constexpr CompressedImageView::Comp _format{format}, _size{size} {} #ifndef MAGNUM_TARGET_GLES -template -#ifndef CORRADE_MSVC2015_COMPATIBILITY -/* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ -constexpr -#endif -CompressedImageView::CompressedImageView(const CompressedPixelFormat format, const VectorTypeFor& size, const Containers::ArrayView data) noexcept: CompressedImageView{{}, format, size, data} {} +template constexpr CompressedImageView::CompressedImageView(const CompressedPixelFormat format, const VectorTypeFor& size, const Containers::ArrayView data) noexcept: CompressedImageView{{}, format, size, data} {} template constexpr CompressedImageView::CompressedImageView(const CompressedPixelFormat format, const VectorTypeFor& size) noexcept: CompressedImageView{{}, format, size} {} #endif diff --git a/src/Magnum/Math/BoolVector.h b/src/Magnum/Math/BoolVector.h index 8641abad1..5b509a72c 100644 --- a/src/Magnum/Math/BoolVector.h +++ b/src/Magnum/Math/BoolVector.h @@ -93,12 +93,7 @@ template class BoolVector { #ifdef DOXYGEN_GENERATING_OUTPUT inline explicit BoolVector(T value); #else - template::value && size != 1, bool>::type> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit BoolVector(T value): BoolVector(typename Implementation::GenerateSequence::Type(), value ? FullSegmentMask : 0) {} + template::value && size != 1, bool>::type> constexpr explicit BoolVector(T value): BoolVector(typename Implementation::GenerateSequence::Type(), value ? FullSegmentMask : 0) {} #endif /** @brief Copy constructor */ diff --git a/src/Magnum/Math/Complex.h b/src/Magnum/Math/Complex.h index 0100b4682..b8ac7987a 100644 --- a/src/Magnum/Math/Complex.h +++ b/src/Magnum/Math/Complex.h @@ -178,12 +178,7 @@ template class Complex { template constexpr explicit Complex(const Complex& other): _real{T(other._real)}, _imaginary{T(other._imaginary)} {} /** @brief Construct complex number from external representation */ - template::from(std::declval()))> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit Complex(const U& other): Complex{Implementation::ComplexConverter::from(other)} {} + template::from(std::declval()))> constexpr explicit Complex(const U& other): Complex{Implementation::ComplexConverter::from(other)} {} /** @brief Convert complex number to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { diff --git a/src/Magnum/Math/DualComplex.h b/src/Magnum/Math/DualComplex.h index 07c888e7b..415f28b63 100644 --- a/src/Magnum/Math/DualComplex.h +++ b/src/Magnum/Math/DualComplex.h @@ -163,12 +163,7 @@ template class DualComplex: public Dual> { {} /** @brief Construct dual complex number from external representation */ - template::from(std::declval()))> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit DualComplex(const U& other): DualComplex{Implementation::DualComplexConverter::from(other)} {} + template::from(std::declval()))> constexpr explicit DualComplex(const U& other): DualComplex{Implementation::DualComplexConverter::from(other)} {} /** @brief Copy constructor */ constexpr DualComplex(const Dual>& other): Dual>(other) {} diff --git a/src/Magnum/Math/DualQuaternion.h b/src/Magnum/Math/DualQuaternion.h index 6d998eb41..b20944114 100644 --- a/src/Magnum/Math/DualQuaternion.h +++ b/src/Magnum/Math/DualQuaternion.h @@ -234,12 +234,7 @@ template class DualQuaternion: public Dual> { template constexpr explicit DualQuaternion(const DualQuaternion& other): Dual>(other) {} /** @brief Construct dual quaternion from external representation */ - template::from(std::declval()))> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit DualQuaternion(const U& other): DualQuaternion{Implementation::DualQuaternionConverter::from(other)} {} + template::from(std::declval()))> constexpr explicit DualQuaternion(const U& other): DualQuaternion{Implementation::DualQuaternionConverter::from(other)} {} /** @brief Copy constructor */ constexpr DualQuaternion(const Dual>& other): Dual>(other) {} diff --git a/src/Magnum/Math/Matrix.h b/src/Magnum/Math/Matrix.h index 7013f9096..0394dc684 100644 --- a/src/Magnum/Math/Matrix.h +++ b/src/Magnum/Math/Matrix.h @@ -132,14 +132,7 @@ template class Matrix: public RectangularMatrix constexpr explicit Matrix(const RectangularMatrix& other): - #ifndef CORRADE_MSVC2015_COMPATIBILITY - RectangularMatrix(other) - #else - /* Avoid using non-constexpr version */ - RectangularMatrix(typename Implementation::GenerateSequence::Type(), other) - #endif - {} + template constexpr explicit Matrix(const RectangularMatrix& other): RectangularMatrix(other) {} /** @brief Construct matrix from external representation */ template::from(std::declval()))> constexpr explicit Matrix(const U& other): RectangularMatrix(Implementation::RectangularMatrixConverter::from(other)) {} diff --git a/src/Magnum/Math/Matrix3.h b/src/Magnum/Math/Matrix3.h index f4702db42..81fcc91b8 100644 --- a/src/Magnum/Math/Matrix3.h +++ b/src/Magnum/Math/Matrix3.h @@ -162,15 +162,8 @@ template class Matrix3: public Matrix3x3 { constexpr /*implicit*/ Matrix3(IdentityInitT = IdentityInit, T value = T{1}) /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT - #ifndef CORRADE_MSVC2015_COMPATIBILITY - : Matrix3x3{IdentityInit, value} - #else - /* Avoid using non-constexpr version, also MSVC 2015 can't handle - {} here */ - : Matrix3x3(Vector<3, T>{value, T(0), T(0)}, - Vector<3, T>{T(0), value, T(0)}, - Vector<3, T>{T(0), T(0), value}) - #endif + /* MSVC 2015 can't handle {} here */ + : Matrix3x3(IdentityInit, value) #endif {} @@ -178,15 +171,8 @@ template class Matrix3: public Matrix3x3 { constexpr explicit Matrix3(ZeroInitT) /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT - #ifndef CORRADE_MSVC2015_COMPATIBILITY + /* MSVC 2015 can't handle {} here */ : Matrix3x3(ZeroInit) - #else - /* Avoid using non-constexpr version, also MSVC 2015 can't handle - {} here */ - : Matrix3x3(Vector<3, T>{T(0), T(0), T(0)}, - Vector<3, T>{T(0), T(0), T(0)}, - Vector<3, T>{T(0), T(0), T(0)}) - #endif #endif {} diff --git a/src/Magnum/Math/Matrix4.h b/src/Magnum/Math/Matrix4.h index 1a209460a..f06289805 100644 --- a/src/Magnum/Math/Matrix4.h +++ b/src/Magnum/Math/Matrix4.h @@ -258,16 +258,8 @@ template class Matrix4: public Matrix4x4 { constexpr /*implicit*/ Matrix4(IdentityInitT = IdentityInit, T value = T{1}) /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT - #ifndef CORRADE_MSVC2015_COMPATIBILITY - : Matrix4x4{IdentityInit, value} - #else - /* Avoid using non-constexpr version, also MSVC 2015 can't handle - {} here */ - : Matrix4x4(Vector<4, T>{value, T(0), T(0), T(0)}, - Vector<4, T>{T(0), value, T(0), T(0)}, - Vector<4, T>{T(0), T(0), value, T(0)}, - Vector<4, T>{T(0), T(0), T(0), value}) - #endif + /* MSVC 2015 can't handle {} here */ + : Matrix4x4(IdentityInit, value) #endif {} @@ -275,16 +267,8 @@ template class Matrix4: public Matrix4x4 { constexpr explicit Matrix4(ZeroInitT) /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT - #ifndef CORRADE_MSVC2015_COMPATIBILITY + /* MSVC 2015 can't handle {} here */ : Matrix4x4(ZeroInit) - #else - /* Avoid using non-constexpr version, also MSVC 2015 can't handle - {} here */ - : Matrix4x4(Vector<4, T>{T(0), T(0), T(0), T(0)}, - Vector<4, T>{T(0), T(0), T(0), T(0)}, - Vector<4, T>{T(0), T(0), T(0), T(0)}, - Vector<4, T>{T(0), T(0), T(0), T(0)}) - #endif #endif {} diff --git a/src/Magnum/Math/Quaternion.h b/src/Magnum/Math/Quaternion.h index f0c0f31c0..5a1d62a09 100644 --- a/src/Magnum/Math/Quaternion.h +++ b/src/Magnum/Math/Quaternion.h @@ -241,12 +241,7 @@ template class Quaternion { template constexpr explicit Quaternion(const Quaternion& other): _vector{other._vector}, _scalar{T(other._scalar)} {} /** @brief Construct quaternion from external representation */ - template::from(std::declval()))> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit Quaternion(const U& other): Quaternion{Implementation::QuaternionConverter::from(other)} {} + template::from(std::declval()))> constexpr explicit Quaternion(const U& other): Quaternion{Implementation::QuaternionConverter::from(other)} {} /** @brief Convert quaternion to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { diff --git a/src/Magnum/Math/Range.h b/src/Magnum/Math/Range.h index e8f33a4b1..ba66e46e8 100644 --- a/src/Magnum/Math/Range.h +++ b/src/Magnum/Math/Range.h @@ -99,12 +99,7 @@ template class Range { template constexpr explicit Range(const Range& other): _min(other._min), _max(other._max) {} /** @brief Construct range from external representation */ - template::from(std::declval()))> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit Range(const U& other): Range{Implementation::RangeConverter::from(other)} {} + template::from(std::declval()))> constexpr explicit Range(const U& other): Range{Implementation::RangeConverter::from(other)} {} /** @brief Convert range to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { diff --git a/src/Magnum/Math/RectangularMatrix.h b/src/Magnum/Math/RectangularMatrix.h index 22d2b6bc8..3638e06d5 100644 --- a/src/Magnum/Math/RectangularMatrix.h +++ b/src/Magnum/Math/RectangularMatrix.h @@ -57,11 +57,6 @@ template class RectangularMatrix { template friend class RectangularMatrix; - #ifdef CORRADE_MSVC2015_COMPATIBILITY - /* Delegating constexpr constructor workarounds */ - friend class Matrix; - #endif - public: typedef T Type; /**< @brief Underlying data type */ @@ -113,12 +108,7 @@ template class RectangularMatrix { } /** @brief Construct zero-filled matrix */ - /** @todo Remove MSVC workaround when fixed */ - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - /*implicit*/ RectangularMatrix(ZeroInitT = ZeroInit) + constexpr /*implicit*/ RectangularMatrix(ZeroInitT = ZeroInit) /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -157,20 +147,10 @@ template class RectangularMatrix { * // integral == {1, 2, -15, 7} * @endcode */ - template - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit RectangularMatrix(const RectangularMatrix& other): RectangularMatrix(typename Implementation::GenerateSequence::Type(), other) {} + template constexpr explicit RectangularMatrix(const RectangularMatrix& other): RectangularMatrix(typename Implementation::GenerateSequence::Type(), other) {} /** @brief Construct matrix from external representation */ - template::from(std::declval()))> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit RectangularMatrix(const U& other): RectangularMatrix(Implementation::RectangularMatrixConverter::from(other)) {} + template::from(std::declval()))> constexpr explicit RectangularMatrix(const U& other): RectangularMatrix(Implementation::RectangularMatrixConverter::from(other)) {} /** @brief Copy constructor */ constexpr RectangularMatrix(const RectangularMatrix&) = default; diff --git a/src/Magnum/Math/Test/BoolVectorTest.cpp b/src/Magnum/Math/Test/BoolVectorTest.cpp index 8ea552829..1995756fb 100644 --- a/src/Magnum/Math/Test/BoolVectorTest.cpp +++ b/src/Magnum/Math/Test/BoolVectorTest.cpp @@ -99,18 +99,10 @@ void BoolVectorTest::constructNoInit() { } void BoolVectorTest::constructOneValue() { - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - BoolVector19 a(false); + constexpr BoolVector19 a(false); CORRADE_COMPARE(a, BoolVector19(0x00, 0x00, 0x00)); - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - BoolVector19 b(true); + constexpr BoolVector19 b(true); CORRADE_COMPARE(b, BoolVector19(0xff, 0xff, 0x07)); CORRADE_VERIFY(!(std::is_convertible::value)); diff --git a/src/Magnum/Math/Test/ComplexTest.cpp b/src/Magnum/Math/Test/ComplexTest.cpp index c869fb391..7da891290 100644 --- a/src/Magnum/Math/Test/ComplexTest.cpp +++ b/src/Magnum/Math/Test/ComplexTest.cpp @@ -201,19 +201,14 @@ void ComplexTest::convert() { /* GCC 5.1 fills the result with zeros instead of properly calling delegated copy constructor if using constexpr. Reported here: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 - MSVC 2015: Can't use delegating constructors with constexpr: - https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - #if (!defined(__GNUC__) || defined(__clang__)) && !defined(CORRADE_MSVC2015_COMPATIBILITY) + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) constexpr #endif Complex c(a); CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Cmpl d(b); + constexpr Cmpl d(b); CORRADE_COMPARE(d.re, a.re); CORRADE_COMPARE(d.im, a.im); diff --git a/src/Magnum/Math/Test/DualComplexTest.cpp b/src/Magnum/Math/Test/DualComplexTest.cpp index 9e0a7096a..134f2bea3 100644 --- a/src/Magnum/Math/Test/DualComplexTest.cpp +++ b/src/Magnum/Math/Test/DualComplexTest.cpp @@ -198,19 +198,14 @@ void DualComplexTest::convert() { /* GCC 5.1 fills the result with zeros instead of properly calling delegated copy constructor if using constexpr. Reported here: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 - MSVC 2015: Can't use delegating constructors with constexpr: - https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - #if (!defined(__GNUC__) || defined(__clang__)) && !defined(CORRADE_MSVC2015_COMPATIBILITY) + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) constexpr #endif DualComplex c{a}; CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - DualCmpl d(b); + constexpr DualCmpl d(b); CORRADE_COMPARE(d.re, a.re); CORRADE_COMPARE(d.im, a.im); CORRADE_COMPARE(d.x, a.x); diff --git a/src/Magnum/Math/Test/DualQuaternionTest.cpp b/src/Magnum/Math/Test/DualQuaternionTest.cpp index b84d8a3ab..c4f98c6b5 100644 --- a/src/Magnum/Math/Test/DualQuaternionTest.cpp +++ b/src/Magnum/Math/Test/DualQuaternionTest.cpp @@ -216,19 +216,14 @@ void DualQuaternionTest::convert() { /* GCC 5.1 fills the result with zeros instead of properly calling delegated copy constructor if using constexpr. Reported here: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 - MSVC 2015: Can't use delegating constructors with constexpr: - https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - #if (!defined(__GNUC__) || defined(__clang__)) && !defined(CORRADE_MSVC2015_COMPATIBILITY) + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) constexpr #endif DualQuaternion c{a}; CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - DualQuat d(b); + constexpr DualQuat d(b); CORRADE_COMPARE(d.re.x, a.re.x); CORRADE_COMPARE(d.re.y, a.re.y); CORRADE_COMPARE(d.re.z, a.re.z); diff --git a/src/Magnum/Math/Test/MatrixTest.cpp b/src/Magnum/Math/Test/MatrixTest.cpp index 264938ec4..810307ecc 100644 --- a/src/Magnum/Math/Test/MatrixTest.cpp +++ b/src/Magnum/Math/Test/MatrixTest.cpp @@ -126,21 +126,9 @@ void MatrixTest::construct() { } void MatrixTest::constructIdentity() { - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Matrix4x4 identity; - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Matrix4x4 identity2{IdentityInit}; - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Matrix4x4 identity3{IdentityInit, 4.0f}; + constexpr Matrix4x4 identity; + constexpr Matrix4x4 identity2{IdentityInit}; + constexpr Matrix4x4 identity3{IdentityInit, 4.0f}; Matrix4x4 identityExpected(Vector4(1.0f, 0.0f, 0.0f, 0.0f), Vector4(0.0f, 1.0f, 0.0f, 0.0f), @@ -158,11 +146,7 @@ void MatrixTest::constructIdentity() { } void MatrixTest::constructZero() { - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Matrix4x4 a{ZeroInit}; + constexpr Matrix4x4 a{ZeroInit}; CORRADE_COMPARE(a, Matrix4x4(Vector4(0.0f, 0.0f, 0.0f, 0.0f), Vector4(0.0f, 0.0f, 0.0f, 0.0f), Vector4(0.0f, 0.0f, 0.0f, 0.0f), @@ -222,10 +206,7 @@ void MatrixTest::convert() { constexpr Matrix3x3 c(b); CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Mat3 d(b); + constexpr Mat3 d(b); for(std::size_t i = 0; i != 9; ++i) CORRADE_COMPARE(d.a[i], a.a[i]); diff --git a/src/Magnum/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp index 5fcb6ad3b..b0f428ec3 100644 --- a/src/Magnum/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -202,19 +202,14 @@ void QuaternionTest::convert() { /* GCC 5.1 fills the result with zeros instead of properly calling delegated copy constructor if using constexpr. Reported here: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 - MSVC 2015: Can't use delegating constructors with constexpr: - https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - #if (!defined(__GNUC__) || defined(__clang__)) && !defined(CORRADE_MSVC2015_COMPATIBILITY) + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) constexpr #endif Quaternion c{a}; CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Quat d(b); + constexpr Quat d(b); CORRADE_COMPARE(d.x, a.x); CORRADE_COMPARE(d.y, a.y); CORRADE_COMPARE(d.z, a.z); diff --git a/src/Magnum/Math/Test/RangeTest.cpp b/src/Magnum/Math/Test/RangeTest.cpp index d882cef88..5fcd2c5b3 100644 --- a/src/Magnum/Math/Test/RangeTest.cpp +++ b/src/Magnum/Math/Test/RangeTest.cpp @@ -215,11 +215,7 @@ void RangeTest::constructConversion() { constexpr Range2D b({1.3f, 2.7f}, {-15.0f, 7.0f}); constexpr Range3D c({1.3f, 2.7f, -1.5f}, {-15.0f, 7.0f, 0.3f}); - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Range1Di d(a); + constexpr Range1Di d(a); CORRADE_COMPARE(d, Range1Di(1, -15)); constexpr Range2Di e(b); @@ -260,14 +256,12 @@ void RangeTest::convert() { /* GCC 5.1 fills the result with zeros instead of properly calling delegated copy constructor if using constexpr. Reported here: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 - MSVC 2015: Can't use delegating constructors with constexpr: - https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - #if (!defined(__GNUC__) || defined(__clang__)) && !defined(CORRADE_MSVC2015_COMPATIBILITY) + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) constexpr #endif Range<2, Float> g{b}; - #if (!defined(__GNUC__) || defined(__clang__)) && !defined(CORRADE_MSVC2015_COMPATIBILITY) + #if !defined(__GNUC__) || defined(__clang__) constexpr #endif Range1D h{a}; @@ -284,26 +278,17 @@ void RangeTest::convert() { CORRADE_COMPARE(i, e); CORRADE_COMPARE(j, f); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Dim k(d); + constexpr Dim k(d); CORRADE_COMPARE(k.offset, a.offset); CORRADE_COMPARE(k.size, a.size); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Rect l(e); + constexpr Rect l(e); CORRADE_COMPARE(l.x, b.x); CORRADE_COMPARE(l.y, b.y); CORRADE_COMPARE(l.w, b.w); CORRADE_COMPARE(l.h, b.h); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Box m(f); + constexpr Box m(f); CORRADE_COMPARE(m.x, c.x); CORRADE_COMPARE(m.y, c.y); CORRADE_COMPARE(m.z, c.z); diff --git a/src/Magnum/Math/Test/RectangularMatrixTest.cpp b/src/Magnum/Math/Test/RectangularMatrixTest.cpp index 1246cd18d..9a7f7e434 100644 --- a/src/Magnum/Math/Test/RectangularMatrixTest.cpp +++ b/src/Magnum/Math/Test/RectangularMatrixTest.cpp @@ -149,16 +149,8 @@ void RectangularMatrixTest::construct() { } void RectangularMatrixTest::constructDefault() { - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Matrix4x3 a; - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Matrix4x3 b{ZeroInit}; + constexpr Matrix4x3 a; + constexpr Matrix4x3 b{ZeroInit}; CORRADE_COMPARE(a, Matrix4x3(Vector3(0.0f, 0.0f, 0.0f), Vector3(0.0f, 0.0f, 0.0f), Vector3(0.0f, 0.0f, 0.0f), @@ -182,11 +174,7 @@ void RectangularMatrixTest::constructNoInit() { void RectangularMatrixTest::constructConversion() { constexpr Matrix2x2 a(Vector2( 1.3f, 2.7f), Vector2(-15.0f, 7.0f)); - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Matrix2x2i b(a); + constexpr Matrix2x2i b(a); CORRADE_COMPARE(b, Matrix2x2i(Vector2i( 1, 2), Vector2i(-15, 7))); @@ -245,19 +233,14 @@ void RectangularMatrixTest::convert() { /* GCC 5.1 fills the result with zeros instead of properly calling delegated copy constructor if using constexpr. Reported here: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 - MSVC 2015: Can't use delegating constructors with constexpr: - https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - #if (!defined(__GNUC__) || defined(__clang__)) && !defined(CORRADE_MSVC2015_COMPATIBILITY) + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) constexpr #endif Matrix2x3 c{a}; CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Mat2x3 d(b); + constexpr Mat2x3 d(b); for(std::size_t i = 0; i != 5; ++i) CORRADE_COMPARE(d.a[i], a.a[i]); diff --git a/src/Magnum/Math/Test/Vector2Test.cpp b/src/Magnum/Math/Test/Vector2Test.cpp index a8cfdd448..eefcaa9bb 100644 --- a/src/Magnum/Math/Test/Vector2Test.cpp +++ b/src/Magnum/Math/Test/Vector2Test.cpp @@ -152,10 +152,7 @@ void Vector2Test::convert() { constexpr Vector2 c(a); CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Vec2 d(b); + constexpr Vec2 d(b); CORRADE_COMPARE(d.x, a.x); CORRADE_COMPARE(d.y, a.y); diff --git a/src/Magnum/Math/Test/Vector3Test.cpp b/src/Magnum/Math/Test/Vector3Test.cpp index af2719585..b22c6c0b7 100644 --- a/src/Magnum/Math/Test/Vector3Test.cpp +++ b/src/Magnum/Math/Test/Vector3Test.cpp @@ -156,10 +156,7 @@ void Vector3Test::convert() { constexpr Vector3 c(a); CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Vec3 d(b); + constexpr Vec3 d(b); CORRADE_COMPARE(d.x, a.x); CORRADE_COMPARE(d.y, a.y); CORRADE_COMPARE(d.z, a.z); diff --git a/src/Magnum/Math/Test/Vector4Test.cpp b/src/Magnum/Math/Test/Vector4Test.cpp index 1fb0d4b8d..2691bd915 100644 --- a/src/Magnum/Math/Test/Vector4Test.cpp +++ b/src/Magnum/Math/Test/Vector4Test.cpp @@ -171,10 +171,7 @@ void Vector4Test::convert() { constexpr Vector4 c(a); CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Vec4 d(b); + constexpr Vec4 d(b); CORRADE_COMPARE(d.x, a.x); CORRADE_COMPARE(d.y, a.y); CORRADE_COMPARE(d.z, a.z); diff --git a/src/Magnum/Math/Test/VectorTest.cpp b/src/Magnum/Math/Test/VectorTest.cpp index 78b43bf47..f49b54eb4 100644 --- a/src/Magnum/Math/Test/VectorTest.cpp +++ b/src/Magnum/Math/Test/VectorTest.cpp @@ -201,11 +201,7 @@ void VectorTest::constructNoInit() { } void VectorTest::constructOneValue() { - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Vector4 a(7.25f); + constexpr Vector4 a(7.25f); CORRADE_COMPARE(a, Vector4(7.25f, 7.25f, 7.25f, 7.25f)); @@ -223,11 +219,7 @@ void VectorTest::constructOneComponent() { void VectorTest::constructConversion() { constexpr Vector4 a(1.3f, 2.7f, -15.0f, 7.0f); - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Vector4i b(a); + constexpr Vector4i b(a); CORRADE_COMPARE(b, Vector4i(1, 2, -15, 7)); @@ -247,19 +239,14 @@ void VectorTest::convert() { /* GCC 5.1 fills the result with zeros instead of properly calling delegated copy constructor if using constexpr. Reported here: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 - MSVC 2015: Can't use delegating constructors with constexpr: - https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - #if (!defined(__GNUC__) || defined(__clang__)) && !defined(CORRADE_MSVC2015_COMPATIBILITY) + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) constexpr #endif Vector3 c{a}; CORRADE_COMPARE(c, b); - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why can't be conversion constexpr? */ - constexpr - #endif - Vec3 d(b); + constexpr Vec3 d(b); CORRADE_COMPARE(d.x, a.x); CORRADE_COMPARE(d.y, a.y); CORRADE_COMPARE(d.z, a.z); diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index e143f7efc..d0f1cdf29 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -98,13 +98,6 @@ template class Vector { template friend class Vector; - #ifdef CORRADE_MSVC2015_COMPATIBILITY - /* Delegating constexpr constructor workarounds */ - friend class Vector2; - friend class Vector3; - friend class Vector4; - #endif - public: typedef T Type; /**< @brief Underlying data type */ @@ -188,12 +181,7 @@ template class Vector { #ifdef DOXYGEN_GENERATING_OUTPUT constexpr explicit Vector(T value); #else - template::value && size != 1, T>::type> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit Vector(U value): Vector(typename Implementation::GenerateSequence::Type(), value) {} + template::value && size != 1, T>::type> constexpr explicit Vector(U value): Vector(typename Implementation::GenerateSequence::Type(), value) {} #endif /** @@ -207,20 +195,10 @@ template class Vector { * // integral == {1, 2, -15, 7} * @endcode */ - template - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit Vector(const Vector& other): Vector(typename Implementation::GenerateSequence::Type(), other) {} + template constexpr explicit Vector(const Vector& other): Vector(typename Implementation::GenerateSequence::Type(), other) {} /** @brief Construct vector from external representation */ - template::from(std::declval()))> - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - explicit Vector(const U& other): Vector(Implementation::VectorConverter::from(other)) {} + template::from(std::declval()))> constexpr explicit Vector(const U& other): Vector(Implementation::VectorConverter::from(other)) {} /** @brief Copy constructor */ constexpr Vector(const Vector&) = default; diff --git a/src/Magnum/Math/Vector2.h b/src/Magnum/Math/Vector2.h index 5aca64b59..44196556a 100644 --- a/src/Magnum/Math/Vector2.h +++ b/src/Magnum/Math/Vector2.h @@ -130,14 +130,7 @@ template class Vector2: public Vector<2, T> { {} /** @copydoc Vector::Vector(T) */ - constexpr explicit Vector2(T value): - #ifndef CORRADE_MSVC2015_COMPATIBILITY - Vector<2, T>(value) - #else - /* Avoid using non-constexpr version */ - Vector<2, T>(value, value) - #endif - {} + constexpr explicit Vector2(T value): Vector<2, T>(value) {} /** * @brief Constructor @@ -149,14 +142,7 @@ template class Vector2: public Vector<2, T> { constexpr /*implicit*/ Vector2(T x, T y): Vector<2, T>(x, y) {} /** @copydoc Vector::Vector(const Vector&) */ - template constexpr explicit Vector2(const Vector<2, U>& other): - #ifndef CORRADE_MSVC2015_COMPATIBILITY - Vector<2, T>(other) - #else - /* Avoid using non-constexpr version */ - Vector<2, T>(typename Implementation::GenerateSequence<2>::Type(), other) - #endif - {} + template constexpr explicit Vector2(const Vector<2, U>& other): Vector<2, T>(other) {} /** @brief Construct vector from external representation */ template class Vector3: public Vector<3, T> { {} /** @copydoc Vector::Vector(T) */ - constexpr explicit Vector3(T value): - #ifndef CORRADE_MSVC2015_COMPATIBILITY - Vector<3, T>(value) - #else - /* Avoid using non-constexpr version */ - Vector<3, T>(value, value, value) - #endif - {} + constexpr explicit Vector3(T value): Vector<3, T>(value) {} /** * @brief Constructor @@ -180,14 +173,7 @@ template class Vector3: public Vector<3, T> { constexpr /*implicit*/ Vector3(const Vector2& xy, T z): Vector<3, T>(xy[0], xy[1], z) {} /** @copydoc Vector::Vector(const Vector&) */ - template constexpr explicit Vector3(const Vector<3, U>& other): - #ifndef CORRADE_MSVC2015_COMPATIBILITY - Vector<3, T>(other) - #else - /* Avoid using non-constexpr version */ - Vector<3, T>(typename Implementation::GenerateSequence<3>::Type(), other) - #endif - {} + template constexpr explicit Vector3(const Vector<3, U>& other): Vector<3, T>(other) {} /** @brief Construct vector from external representation */ template class Vector4: public Vector<4, T> { {} /** @copydoc Vector::Vector(T) */ - constexpr explicit Vector4(T value): - #ifndef CORRADE_MSVC2015_COMPATIBILITY - Vector<4, T>(value) - #else - /* Avoid using non-constexpr version */ - Vector<4, T>(value, value, value, value) - #endif - {} + constexpr explicit Vector4(T value): Vector<4, T>(value) {} /** * @brief Constructor @@ -106,14 +99,7 @@ template class Vector4: public Vector<4, T> { constexpr /*implicit*/ Vector4(const Vector3& xyz, T w): Vector<4, T>(xyz[0], xyz[1], xyz[2], w) {} /** @copydoc Vector::Vector(const Vector&) */ - template constexpr explicit Vector4(const Vector<4, U>& other): - #ifndef CORRADE_MSVC2015_COMPATIBILITY - Vector<4, T>(other) - #else - /* Avoid using non-constexpr version */ - Vector<4, T>(typename Implementation::GenerateSequence<4>::Type(), other) - #endif - {} + template constexpr explicit Vector4(const Vector<4, U>& other): Vector<4, T>(other) {} /** @brief Construct vector from external representation */ template::from(std::declval()))> constexpr explicit Vector4(const U& other): Vector<4, T>(Implementation::VectorConverter<4, T, U>::from(other)) {} diff --git a/src/Magnum/Test/ArrayTest.cpp b/src/Magnum/Test/ArrayTest.cpp index 7a5048235..70a88c4e8 100644 --- a/src/Magnum/Test/ArrayTest.cpp +++ b/src/Magnum/Test/ArrayTest.cpp @@ -51,11 +51,7 @@ void ArrayTest::construct() { constexpr Array<3, Int> a = {5, 6, 7}; CORRADE_COMPARE(a, (Array<3, Int>(5, 6, 7))); - #ifndef CORRADE_MSVC2015_COMPATIBILITY - /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ - constexpr - #endif - Array<3, Int> a2 = 5; + constexpr Array<3, Int> a2 = 5; CORRADE_COMPARE(a2, (Array<3, Int>(5, 5, 5))); constexpr Array1D b = 5;