From d1025d00292c4fda84a94ead6b6705c0bedf8e06 Mon Sep 17 00:00:00 2001 From: Varun Saini <61795485+vrn-sn@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:25:04 -0800 Subject: [PATCH] Remove noexcepts from Config (#1523) Fixes https://github.com/luau-lang/luau/issues/1515. By removing these `noexcept`s, we guarantee that the internal call to `std::swap` uses move semantics when a `Config` is copy-assigned. --- Config/include/Luau/Config.h | 8 ++++---- Config/src/Config.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Config/include/Luau/Config.h b/Config/include/Luau/Config.h index d6016229..64b76f07 100644 --- a/Config/include/Luau/Config.h +++ b/Config/include/Luau/Config.h @@ -21,10 +21,10 @@ constexpr const char* kConfigName = ".luaurc"; struct Config { Config(); - Config(const Config& other) noexcept; - Config& operator=(const Config& other) noexcept; - Config(Config&& other) noexcept = default; - Config& operator=(Config&& other) noexcept = default; + Config(const Config& other); + Config& operator=(const Config& other); + Config(Config&& other) = default; + Config& operator=(Config&& other) = default; Mode mode = Mode::Nonstrict; diff --git a/Config/src/Config.cpp b/Config/src/Config.cpp index 3760fd9e..345e039c 100644 --- a/Config/src/Config.cpp +++ b/Config/src/Config.cpp @@ -17,7 +17,7 @@ Config::Config() enabledLint.setDefaults(); } -Config::Config(const Config& other) noexcept +Config::Config(const Config& other) : mode(other.mode) , parseOptions(other.parseOptions) , enabledLint(other.enabledLint) @@ -40,7 +40,7 @@ Config::Config(const Config& other) noexcept } } -Config& Config::operator=(const Config& other) noexcept +Config& Config::operator=(const Config& other) { if (this != &other) {