Browse Source

MSVC 2015 compatibility: random stuff that's causing compiler crashes.

Random indeed. In particular, it's causing crashes for Vector2 and
Vector3, but not for the exact same code in Vector4!
pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
bfbacaa7c9
  1. 9
      src/Magnum/Math/Range.h
  2. 9
      src/Magnum/Math/Vector2.h
  3. 9
      src/Magnum/Math/Vector3.h

9
src/Magnum/Math/Range.h

@ -259,7 +259,14 @@ template<class T> class Range2D: public Range<2, T> {
* @brief Construct range from external representation
* @todoc Remove workaround when Doxygen no longer chokes on that line
*/
template<class U, class V = decltype(Implementation::RangeConverter<2, T, U>::from(std::declval<U>()))> constexpr explicit Range2D(const U& other)
template<class U, class V =
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Causes ICE */
decltype(Implementation::RangeConverter<2, T, U>::from(std::declval<U>()))
#else
decltype(Implementation::RangeConverter<2, T, U>())
#endif
>
constexpr explicit Range2D(const U& other)
#ifndef DOXYGEN_GENERATING_OUTPUT
/* MSVC 2015 can't handle {} here */
: Range<2, T>(Implementation::RangeConverter<2, T, U>::from(other))

9
src/Magnum/Math/Vector2.h

@ -159,7 +159,14 @@ template<class T> class Vector2: public Vector<2, T> {
{}
/** @brief Construct vector from external representation */
template<class U, class V = decltype(Implementation::VectorConverter<2, T, U>::from(std::declval<U>()))> constexpr explicit Vector2(const U& other): Vector<2, T>(Implementation::VectorConverter<2, T, U>::from(other)) {}
template<class U, class V =
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Causes ICE */
decltype(Implementation::VectorConverter<2, T, U>::from(std::declval<U>()))
#else
decltype(Implementation::VectorConverter<2, T, U>())
#endif
>
constexpr explicit Vector2(const U& other): Vector<2, T>(Implementation::VectorConverter<2, T, U>::from(other)) {}
/** @brief Copy constructor */
constexpr Vector2(const Vector<2, T>& other): Vector<2, T>(other) {}

9
src/Magnum/Math/Vector3.h

@ -190,7 +190,14 @@ template<class T> class Vector3: public Vector<3, T> {
{}
/** @brief Construct vector from external representation */
template<class U, class V = decltype(Implementation::VectorConverter<3, T, U>::from(std::declval<U>()))> constexpr explicit Vector3(const U& other): Vector<3, T>(Implementation::VectorConverter<3, T, U>::from(other)) {}
template<class U, class V =
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Causes ICE */
decltype(Implementation::VectorConverter<3, T, U>::from(std::declval<U>()))
#else
decltype(Implementation::VectorConverter<3, T, U>())
#endif
>
constexpr explicit Vector3(const U& other): Vector<3, T>(Implementation::VectorConverter<3, T, U>::from(other)) {}
/** @brief Copy constructor */
constexpr Vector3(const Vector<3, T>& other): Vector<3, T>(other) {}

Loading…
Cancel
Save