diff options
author | Brad King <brad.king@kitware.com> | 2021-12-07 22:35:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-12-08 15:31:55 (GMT) |
commit | 61c46c95aecd09e335dfae7c3123053c3e2ef381 (patch) | |
tree | 6328a04a351d6c2c4e7e353a2c9883bb3b0f1458 /Source/cmListFileCache.h | |
parent | d0ceb409ff2d9eecb992e7d37780137f9330a748 (diff) | |
download | CMake-61c46c95aecd09e335dfae7c3123053c3e2ef381.zip CMake-61c46c95aecd09e335dfae7c3123053c3e2ef381.tar.gz CMake-61c46c95aecd09e335dfae7c3123053c3e2ef381.tar.bz2 |
cmListFileContext: Simplify explicit rule-of-five members
Diffstat (limited to 'Source/cmListFileCache.h')
-rw-r--r-- | Source/cmListFileCache.h | 20 |
1 files 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<std::string> 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<std::string> deferId = {}) |