From f8ce3f08b5b8e49ef41dd72760ca617d4907acec Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 18 Sep 2020 15:31:30 +1000 Subject: Fix building with Xcode 12 by defining move constructors for FontAlias, Style, and PositionCacheEntry. --- src/PositionCache.h | 2 +- src/Style.cxx | 5 +++++ src/Style.h | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/PositionCache.h b/src/PositionCache.h index cdcc3ef74..7573a2dc3 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -187,8 +187,8 @@ public: PositionCacheEntry() noexcept; // Copy constructor not currently used, but needed for being element in std::vector. PositionCacheEntry(const PositionCacheEntry &); + PositionCacheEntry(PositionCacheEntry &&) noexcept = default; // Deleted so PositionCacheEntry objects can not be assigned. - PositionCacheEntry(PositionCacheEntry &&) = delete; void operator=(const PositionCacheEntry &) = delete; void operator=(PositionCacheEntry &&) = delete; ~PositionCacheEntry(); diff --git a/src/Style.cxx b/src/Style.cxx index 00497db67..ff2b49bc2 100644 --- a/src/Style.cxx +++ b/src/Style.cxx @@ -24,6 +24,11 @@ FontAlias::FontAlias(const FontAlias &other) noexcept : Font() { SetID(other.fid); } +FontAlias::FontAlias(FontAlias &&other) noexcept : Font() { + SetID(other.fid); + other.ClearFont(); +} + FontAlias::~FontAlias() { SetID(FontID{}); // ~Font will not release the actual font resource since it is now 0 diff --git a/src/Style.h b/src/Style.h index 432dcf946..071d752ca 100644 --- a/src/Style.h +++ b/src/Style.h @@ -33,9 +33,9 @@ struct FontSpecification { class FontAlias : public Font { public: FontAlias() noexcept; - // FontAlias objects can not be assigned except for initialization + // FontAlias objects can be copy or move constructed but not be assigned FontAlias(const FontAlias &) noexcept; - FontAlias(FontAlias &&) = delete; + FontAlias(FontAlias &&) noexcept; FontAlias &operator=(const FontAlias &) = delete; FontAlias &operator=(FontAlias &&) = delete; ~FontAlias() override; @@ -72,7 +72,7 @@ public: Style(); Style(const Style &source) noexcept; - Style(Style &&) = delete; + Style(Style &&) noexcept = default; ~Style(); Style &operator=(const Style &source) noexcept; Style &operator=(Style &&) = delete; -- cgit v1.2.3