From ea5020a77305048c1a250cd493562b42be40bc03 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 20 Oct 2018 17:25:59 +0000 Subject: [PATCH] Fix gcc-4.9 build of similar/main/wall.cpp gcc-4.9 shipped without support for std::is_trivially_move_assignable. This is only needed in a sanity check, so preprocess it out when using a gcc below gcc-5. Reported-by: joolswills Fixes: 57334255acf6decd5d4ea84c8ee509327f13fd04 ("Simplify stuck object cleanup") --- similar/main/wall.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/similar/main/wall.cpp b/similar/main/wall.cpp index a7a8f6618..f6baec557 100644 --- a/similar/main/wall.cpp +++ b/similar/main/wall.cpp @@ -1318,7 +1318,17 @@ void d_level_unique_stuck_object_state::remove_stuck_object(const vcobjidx_t obj * last object. */ auto &last_element = *std::prev(pr.end()); +#if defined(__clang__) || __GNUC__ >= 5 + /* gcc-4.9.x shipped without support for + * `std::is_trivially_move_assignable`. Since this is just a sanity check + * to warn developers to be careful, restricting it to occur only with + * later compilers is acceptable. + * + * clang claims to be gcc 4.2.1, but does implement + * `std::is_trivially_move_assignable`, so enable it for clang. + */ static_assert(std::is_trivially_move_assignable::value, "stuckobj move may require a check to prevent self-move"); +#endif *i = std::move(last_element); DXX_POISON_VAR(last_element.wallnum, 0xcc); DXX_POISON_VAR(last_element.objnum, 0xcc);