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.
This commit is contained in:
Varun Saini 2024-11-12 14:25:04 -08:00 committed by GitHub
parent 53e6e4b8f0
commit d1025d0029
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -21,10 +21,10 @@ constexpr const char* kConfigName = ".luaurc";
struct Config struct Config
{ {
Config(); Config();
Config(const Config& other) noexcept; Config(const Config& other);
Config& operator=(const Config& other) noexcept; Config& operator=(const Config& other);
Config(Config&& other) noexcept = default; Config(Config&& other) = default;
Config& operator=(Config&& other) noexcept = default; Config& operator=(Config&& other) = default;
Mode mode = Mode::Nonstrict; Mode mode = Mode::Nonstrict;

View file

@ -17,7 +17,7 @@ Config::Config()
enabledLint.setDefaults(); enabledLint.setDefaults();
} }
Config::Config(const Config& other) noexcept Config::Config(const Config& other)
: mode(other.mode) : mode(other.mode)
, parseOptions(other.parseOptions) , parseOptions(other.parseOptions)
, enabledLint(other.enabledLint) , 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) if (this != &other)
{ {