mirror of
https://github.com/scummvm/scummvm.git
synced 2026-05-21 05:40:43 +00:00
MATH: Add workaround for MSVC 2015 compiler bug (C2248)
At least MSVC 2015 (14.0.25420.01 Update 3) will hit a C2248 compiler error. Quoting @lephilousophe, "It looks like a bug. It tries to generate a move constructor but it believes it can't access the base constructor, although the constructor it creates is in a child class, while the MatrixBase constructor is protected." Since MSVC 2015 is still able to compile most of the engines and components (not all of them, though), having a local hack for it seems reasonable...
This commit is contained in:
@@ -142,12 +142,17 @@ public:
|
||||
Matrix<rows, cols> &operator/=(float factor);
|
||||
Matrix<rows, cols> &operator/=(const Matrix<rows, cols> &m);
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1910 // HACK: C2248 bug in MSVC 2015
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
constexpr MatrixBase() = default;
|
||||
MatrixBase(const float *data);
|
||||
MatrixBase(const MatrixBase<rows, cols> &m);
|
||||
MatrixBase &operator=(const MatrixBase<rows, cols> &m);
|
||||
|
||||
protected:
|
||||
inline const Matrix<rows, cols> &getThis() const {
|
||||
return *static_cast<const Matrix<rows, cols> *>(this); }
|
||||
inline Matrix<rows, cols> &getThis() {
|
||||
@@ -163,7 +168,11 @@ private:
|
||||
*/
|
||||
template<int r, int c>
|
||||
class MatrixType : public MatrixBase<r, c> {
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1910 // HACK: C2248 bug in MSVC 2015
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
constexpr MatrixType() : MatrixBase<r, c>() { }
|
||||
MatrixType(const float *data) : MatrixBase<r, c>(data) { }
|
||||
MatrixType(const MatrixBase<r, c> &m) : MatrixBase<r, c>(m) { }
|
||||
|
||||
@@ -57,7 +57,11 @@ public:
|
||||
*/
|
||||
void readFromStream(Common::ReadStream *stream);
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1910 // HACK: C2248 bug in MSVC 2015
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
MatrixType() : MatrixBase<dim, 1>() { }
|
||||
MatrixType(const float *data) : MatrixBase<dim, 1>(data) { }
|
||||
MatrixType(const MatrixBase<dim, 1> &m) : MatrixBase<dim, 1>(m) { }
|
||||
|
||||
Reference in New Issue
Block a user