mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-26 12:35:32 +00:00
Fix move assignment.
This commit is contained in:
parent
823ce5fc3d
commit
1a6d365db5
@ -204,7 +204,7 @@ TEST(FileTest, MoveAssignmentClosesFile) {
|
|||||||
File f2("CMakeLists.txt", File::RDONLY);
|
File f2("CMakeLists.txt", File::RDONLY);
|
||||||
int old_fd = f2.descriptor();
|
int old_fd = f2.descriptor();
|
||||||
f2 = std::move(f);
|
f2 = std::move(f);
|
||||||
EXPECT_TRUE(IsClosedInternal(old_fd));
|
EXPECT_CLOSED(old_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
File OpenFile(int &fd) {
|
File OpenFile(int &fd) {
|
||||||
|
@ -177,7 +177,8 @@ class File {
|
|||||||
other.fd_ = -1;
|
other.fd_ = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
File& operator=(File &&other) FMT_NOEXCEPT(true) {
|
File& operator=(File &&other) {
|
||||||
|
close();
|
||||||
fd_ = other.fd_;
|
fd_ = other.fd_;
|
||||||
other.fd_ = -1;
|
other.fd_ = -1;
|
||||||
return *this;
|
return *this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user