From b8ee9d88ba28f079533898a4e036ae71eeff19d3 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 8 Apr 2018 11:18:20 +0300 Subject: [PATCH] Fixed non-constant condition for static assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 7: src/gl/renderer/gl_renderer.cpp:702:2: error: non-constant condition for static assertion src/gl/renderer/gl_renderer.cpp:702:2: error: value ‘12’ of type ‘float*’ is not a constant expression src/gl/renderer/gl_renderer.cpp:703:2: error: non-constant condition for static assertion src/gl/renderer/gl_renderer.cpp:703:2: error: value ‘20’ of type ‘PalEntry*’ is not a constant expression Clang: src/gl/renderer/gl_renderer.cpp:701:16: error: static_assert expression is not an integral constant expression src/gl/renderer/gl_renderer.cpp:701:23: note: cannot access field of null pointer --- src/gl/renderer/gl_renderer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index d8f4890f2..0a744d4f0 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -697,16 +697,15 @@ void FGLRenderer::DrawBlend(sector_t * viewsector, bool FixedColormap, bool doco // Vertex buffer for 2D drawer // //=========================================================================== -#define TDiO ((F2DDrawer::TwoDVertex*)NULL) class F2DVertexBuffer : public FSimpleVertexBuffer { uint32_t ibo_id; // Make sure we can build upon FSimpleVertexBuffer. - static_assert(&VSiO->x == &TDiO->x, "x not aligned"); - static_assert(&VSiO->u == &TDiO->u, "y not aligned"); - static_assert(&VSiO->color == &TDiO->color0, "color not aligned"); + static_assert(offsetof(FSimpleVertex, x) == offsetof(F2DDrawer::TwoDVertex, x), "x not aligned"); + static_assert(offsetof(FSimpleVertex, u) == offsetof(F2DDrawer::TwoDVertex, u), "u not aligned"); + static_assert(offsetof(FSimpleVertex, color) == offsetof(F2DDrawer::TwoDVertex, color0), "color not aligned"); public: