From 61c46c95aecd09e335dfae7c3123053c3e2ef381 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Dec 2021 17:35:44 -0500 Subject: cmListFileContext: Simplify explicit rule-of-five members --- Source/cmListFileCache.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 65b4772..4a52876 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -80,6 +80,18 @@ public: cm::optional DeferId; cmListFileContext() = default; + cmListFileContext(cmListFileContext&& /*other*/) = default; + cmListFileContext(const cmListFileContext& /*other*/) = default; + cmListFileContext& operator=(const cmListFileContext& /*other*/) = default; +#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) + cmListFileContext& operator=(cmListFileContext&& /*other*/) = default; +#else + // The move assignment operators for several STL classes did not become + // noexcept until C++17, which causes some tools to warn about this move + // assignment operator throwing an exception when it shouldn't. + cmListFileContext& operator=(cmListFileContext&& /*other*/) = delete; +#endif + cmListFileContext(std::string name, std::string filePath, long line) : Name(std::move(name)) , FilePath(std::move(filePath)) @@ -87,14 +99,6 @@ public: { } -#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L) - cmListFileContext(const cmListFileContext& /*other*/) = default; - cmListFileContext(cmListFileContext&& /*other*/) = default; - - cmListFileContext& operator=(const cmListFileContext& /*other*/) = default; - cmListFileContext& operator=(cmListFileContext&& /*other*/) = delete; -#endif - static cmListFileContext FromCommandContext( cmCommandContext const& lfcc, std::string const& fileName, cm::optional deferId = {}) -- cgit v0.12