From 921e17148a05931828594a4fcf8519195decb3cb Mon Sep 17 00:00:00 2001 From: Sudarsana Babu Nagineni Date: Mon, 9 Jul 2018 11:18:30 +0300 Subject: Fix compilation errors with libc++ on QNX 7 This patch fixes the compilation errors on QNX 7: 1) It seems that the QNX 7 compiler (i.e qcc based GCC 5.4.0 with libc++ from LLVM) has a limited c++11 feature support and causing the compilation errors with the inheriting constructors. Fix the issues by providing the required constructors explicitly. 2) Resolve an ambiguous overload error with optional 3) Remove use of noncopyable in Context --- include/mbgl/style/expression/compound_expression.hpp | 5 ++++- src/mbgl/gl/context.hpp | 5 ++++- src/mbgl/style/expression/interpolate.cpp | 12 ++++++------ src/mbgl/style/expression/match.cpp | 6 +++--- src/mbgl/style/expression/step.cpp | 12 ++++++------ src/mbgl/tile/geometry_tile_data.hpp | 16 ++++++++-------- test/api/recycle_map.cpp | 2 +- 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/include/mbgl/style/expression/compound_expression.hpp b/include/mbgl/style/expression/compound_expression.hpp index 9d39194563..0e37875394 100644 --- a/include/mbgl/style/expression/compound_expression.hpp +++ b/include/mbgl/style/expression/compound_expression.hpp @@ -33,7 +33,10 @@ namespace expression { */ struct VarargsType { type::Type type; }; template -struct Varargs : std::vector { using std::vector::vector; }; +struct Varargs : std::vector { + template + Varargs(Args&&... args) : std::vector(std::forward(args)...) {} +}; namespace detail { // Base class for the Signature structs that are used to determine diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index d95311115e..662930d5b1 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -36,7 +36,7 @@ class Debugging; class ProgramBinary; } // namespace extension -class Context : private util::noncopyable { +class Context { public: Context(); ~Context(); @@ -298,6 +298,9 @@ private: std::vector abandonedFramebuffers; std::vector abandonedRenderbuffers; + Context(const Context&) = delete; + Context& operator=(const Context& other) = delete; + public: // For testing and Windows because Qt + ANGLE // crashes with VAO enabled. diff --git a/src/mbgl/style/expression/interpolate.cpp b/src/mbgl/style/expression/interpolate.cpp index a9bb3bf05e..31fd360fa9 100644 --- a/src/mbgl/style/expression/interpolate.cpp +++ b/src/mbgl/style/expression/interpolate.cpp @@ -170,23 +170,23 @@ ParseResult parseInterpolate(const Convertible& value, ParsingContext& ctx) { labelValue->match( [&](uint64_t n) { if (n > std::numeric_limits::max()) { - label = {std::numeric_limits::infinity()}; + label = optional{std::numeric_limits::infinity()}; } else { - label = {static_cast(n)}; + label = optional{static_cast(n)}; } }, [&](int64_t n) { if (n > std::numeric_limits::max()) { - label = {std::numeric_limits::infinity()}; + label = optional{std::numeric_limits::infinity()}; } else { - label = {static_cast(n)}; + label = optional{static_cast(n)}; } }, [&](double n) { if (n > std::numeric_limits::max()) { - label = {std::numeric_limits::infinity()}; + label = optional{std::numeric_limits::infinity()}; } else { - label = {static_cast(n)}; + label = optional{n}; } }, [&](const auto&) {} diff --git a/src/mbgl/style/expression/match.cpp b/src/mbgl/style/expression/match.cpp index 59123c9812..2107b42a13 100644 --- a/src/mbgl/style/expression/match.cpp +++ b/src/mbgl/style/expression/match.cpp @@ -137,7 +137,7 @@ optional parseInputValue(const Convertible& input, ParsingContext& pa parentContext.error("Branch labels must be integers no larger than " + util::toString(Value::maxSafeInteger()) + ".", index); } else { type = {type::Number}; - result = {static_cast(n)}; + result = optional{static_cast(n)}; } }, [&] (int64_t n) { @@ -145,7 +145,7 @@ optional parseInputValue(const Convertible& input, ParsingContext& pa parentContext.error("Branch labels must be integers no larger than " + util::toString(Value::maxSafeInteger()) + ".", index); } else { type = {type::Number}; - result = {n}; + result = optional{n}; } }, [&] (double n) { @@ -155,7 +155,7 @@ optional parseInputValue(const Convertible& input, ParsingContext& pa parentContext.error("Numeric branch labels must be integer values.", index); } else { type = {type::Number}; - result = {static_cast(n)}; + result = optional{static_cast(n)}; } }, [&] (const std::string& s) { diff --git a/src/mbgl/style/expression/step.cpp b/src/mbgl/style/expression/step.cpp index f42a2721a9..c2113dd1c3 100644 --- a/src/mbgl/style/expression/step.cpp +++ b/src/mbgl/style/expression/step.cpp @@ -126,23 +126,23 @@ ParseResult Step::parse(const mbgl::style::conversion::Convertible& value, Parsi labelValue->match( [&](uint64_t n) { if (n > std::numeric_limits::max()) { - label = {std::numeric_limits::infinity()}; + label = optional{std::numeric_limits::infinity()}; } else { - label = {static_cast(n)}; + label = optional{static_cast(n)}; } }, [&](int64_t n) { if (n > std::numeric_limits::max()) { - label = {std::numeric_limits::infinity()}; + label = optional{std::numeric_limits::infinity()}; } else { - label = {static_cast(n)}; + label = optional{static_cast(n)}; } }, [&](double n) { if (n > std::numeric_limits::max()) { - label = {std::numeric_limits::infinity()}; + label = optional{std::numeric_limits::infinity()}; } else { - label = {static_cast(n)}; + label = optional{n}; } }, [&](const auto&) {} diff --git a/src/mbgl/tile/geometry_tile_data.hpp b/src/mbgl/tile/geometry_tile_data.hpp index 449d8cab28..bd64a1d153 100644 --- a/src/mbgl/tile/geometry_tile_data.hpp +++ b/src/mbgl/tile/geometry_tile_data.hpp @@ -22,19 +22,19 @@ class GeometryCoordinates : public std::vector { public: using coordinate_type = int16_t; - GeometryCoordinates() = default; - GeometryCoordinates(const std::vector& v) - : std::vector(v) {} - GeometryCoordinates(std::vector&& v) - : std::vector(std::move(v)) {} - - using std::vector::vector; + template + GeometryCoordinates(Args&&... args) : std::vector(std::forward(args)...) {} + GeometryCoordinates(std::initializer_list args) + : std::vector(std::move(args)) {} }; class GeometryCollection : public std::vector { public: using coordinate_type = int16_t; - using std::vector::vector; + template + GeometryCollection(Args&&... args) : std::vector(std::forward(args)...) {} + GeometryCollection(std::initializer_list args) + : std::vector(std::move(args)) {} }; class GeometryTileFeature { diff --git a/test/api/recycle_map.cpp b/test/api/recycle_map.cpp index ca6abac8c1..fc7e5223ec 100644 --- a/test/api/recycle_map.cpp +++ b/test/api/recycle_map.cpp @@ -35,7 +35,7 @@ TEST(API, RecycleMapUpdateImages) { auto loadStyle = [&](auto markerName, auto markerPath) { auto source = std::make_unique("geometry"); - source->setGeoJSON({ Point { 0, 0 } }); + source->setGeoJSON( Geometry{ Point{ 0, 0 } } ); auto layer = std::make_unique("geometry", "geometry"); layer->setIconImage({ markerName }); -- cgit v1.2.1