From 41d57f03478e8c2aca91bf1c35677b471c14a414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 21 Nov 2019 18:37:36 +0100 Subject: [PATCH] GCC 4.8, happy to see you're still around, causing problems. --- src/Magnum/Math/Test/PackingBatchTest.cpp | 8 ++++++-- src/Magnum/Primitives/Implementation/Spheroid.cpp | 15 +++++++++------ src/Magnum/Trade/Test/MeshData2DTest.cpp | 12 ++++++++---- src/Magnum/Trade/Test/MeshData3DTest.cpp | 12 ++++++++---- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/Magnum/Math/Test/PackingBatchTest.cpp b/src/Magnum/Math/Test/PackingBatchTest.cpp index dc43e6efdf..a09ad42904 100644 --- a/src/Magnum/Math/Test/PackingBatchTest.cpp +++ b/src/Magnum/Math/Test/PackingBatchTest.cpp @@ -336,7 +336,9 @@ template void PackingBatchTest::castUnsigned() { {{13, 255}, {}} }; - constexpr Vector2 expectedFloat[] { + /* GCC 4.8 doesn't like constexpr here (cannot initialize aggregate of type + ‘const Vector2 [3]’ with a compound literal), wtf */ + const Vector2 expectedFloat[] { {0.0f, 89.0f}, {149.0f, 22.0f}, {13.0f, 255.0f} @@ -374,7 +376,9 @@ template void PackingBatchTest::castSigned() { {{13, 127}, {}} }; - constexpr Vector2 expectedFloat[] { + /* GCC 4.8 doesn't like constexpr here (cannot initialize aggregate of type + ‘const Vector2 [3]’ with a compound literal), wtf */ + const Vector2 expectedFloat[] { {0.0f, -89.0f}, {-119.0f, 22.0f}, {13.0f, 127.0f} diff --git a/src/Magnum/Primitives/Implementation/Spheroid.cpp b/src/Magnum/Primitives/Implementation/Spheroid.cpp index 22126fbc35..aef2004932 100644 --- a/src/Magnum/Primitives/Implementation/Spheroid.cpp +++ b/src/Magnum/Primitives/Implementation/Spheroid.cpp @@ -229,17 +229,20 @@ Trade::MeshData Spheroid::finalize() { auto typedVertices = reinterpret_cast(_vertexData.data()); Trade::MeshAttributeData positions{Trade::MeshAttributeName::Position, - Containers::stridedArrayView(_vertexData, &typedVertices[0].position, - size, stride)}; + /* GCC 4.8 needs the arrayView() */ + Containers::stridedArrayView(Containers::arrayView(_vertexData), + &typedVertices[0].position, size, stride)}; Trade::MeshAttributeData normals{Trade::MeshAttributeName::Normal, - Containers::stridedArrayView(_vertexData, &typedVertices[0].normal, - size, stride)}; + /* GCC 4.8 needs the arrayView() */ + Containers::stridedArrayView(Containers::arrayView(_vertexData), + &typedVertices[0].normal, size, stride)}; Containers::Array attributes; if(_textureCoords == TextureCoords::Generate) { Trade::MeshAttributeData textureCoords{Trade::MeshAttributeName::TextureCoordinates, - Containers::stridedArrayView(_vertexData, &typedVertices[0].textureCoords, - size, stride)}; + /* GCC 4.8 needs the arrayView() */ + Containers::stridedArrayView(Containers::arrayView(_vertexData), + &typedVertices[0].textureCoords, size, stride)}; attributes = Containers::Array{Containers::InPlaceInit, {positions, normals, textureCoords}}; } else { attributes = Containers::Array{Containers::InPlaceInit, {positions, normals}}; diff --git a/src/Magnum/Trade/Test/MeshData2DTest.cpp b/src/Magnum/Trade/Test/MeshData2DTest.cpp index 1dba8e6ecc..3d9eda0bb9 100644 --- a/src/Magnum/Trade/Test/MeshData2DTest.cpp +++ b/src/Magnum/Trade/Test/MeshData2DTest.cpp @@ -84,7 +84,9 @@ struct { {{0xff98ab_rgbf, 0xff3366_rgbf}}, &State}}, {"from MeshData", - MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, { + /* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries + to use a deleted copy constructor */ + MeshData2D{MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, { MeshAttributeData{MeshAttributeName::Position, Containers::StridedArrayView1D{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}}, MeshAttributeData{MeshAttributeName::Position, @@ -97,15 +99,17 @@ struct { Containers::StridedArrayView1D{Vertices, &Vertices[0].textureCoords3, 2, sizeof(Vertex)}}, MeshAttributeData{MeshAttributeName::Color, Containers::StridedArrayView1D{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}}, - }, &State}, - MeshData{MeshPrimitive::Lines, {}, Vertices, { + }, &State}}, + /* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries + to use a deleted copy constructor */ + MeshData2D{MeshData{MeshPrimitive::Lines, {}, Vertices, { MeshAttributeData{MeshAttributeName::Position, Containers::StridedArrayView1D{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}}, MeshAttributeData{MeshAttributeName::TextureCoordinates, Containers::StridedArrayView1D{Vertices, &Vertices[0].textureCoords1, 2, sizeof(Vertex)}}, MeshAttributeData{MeshAttributeName::Color, Containers::StridedArrayView1D{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}}, - }, &State} + }, &State}} } }; CORRADE_IGNORE_DEPRECATED_POP diff --git a/src/Magnum/Trade/Test/MeshData3DTest.cpp b/src/Magnum/Trade/Test/MeshData3DTest.cpp index 6cd447772a..118491709d 100644 --- a/src/Magnum/Trade/Test/MeshData3DTest.cpp +++ b/src/Magnum/Trade/Test/MeshData3DTest.cpp @@ -90,7 +90,9 @@ struct { {{0xff98ab_rgbf, 0xff3366_rgbf}}, &State}}, {"from MeshData", - MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, { + /* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries + to use a deleted copy constructor */ + MeshData3D{MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, { MeshAttributeData{MeshAttributeName::Position, Containers::StridedArrayView1D{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}}, MeshAttributeData{MeshAttributeName::Position, @@ -105,8 +107,10 @@ struct { Containers::StridedArrayView1D{Vertices, &Vertices[0].textureCoords3, 2, sizeof(Vertex)}}, MeshAttributeData{MeshAttributeName::Color, Containers::StridedArrayView1D{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}}, - }, &State}, - MeshData{MeshPrimitive::Lines, {}, Vertices, { + }, &State}}, + /* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries + to use a deleted copy constructor */ + MeshData3D{MeshData{MeshPrimitive::Lines, {}, Vertices, { MeshAttributeData{MeshAttributeName::Position, Containers::StridedArrayView1D{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}}, MeshAttributeData{MeshAttributeName::Normal, @@ -115,7 +119,7 @@ struct { Containers::StridedArrayView1D{Vertices, &Vertices[0].textureCoords1, 2, sizeof(Vertex)}}, MeshAttributeData{MeshAttributeName::Color, Containers::StridedArrayView1D{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}}, - }, &State} + }, &State}} } }; CORRADE_IGNORE_DEPRECATED_POP