From c65b4d03c76da607b6b678c4a46baa75ca0cf7b3 Mon Sep 17 00:00:00 2001 From: Stephan Hartmann Date: Wed, 27 May 2020 18:46:40 +0000 Subject: [PATCH] GCC: make base::FilePath move assignment operator noexcept The move assignment operator in PaintPreviewClient::PaintPreviewData is noexcept. Because this class has a member of type base::FilePath, the move assignment operator of base::FilePath must be noexcept too. Otherwise GCC fails like this: ../../components/paint_preview/browser/paint_preview_client.cc:107:1: error: function 'paint_preview::PaintPreviewClient::PaintPreviewData& paint_preview::PaintPreviewClient::PaintPreviewData::operator= (paint_preview::PaintPreviewClient::PaintPreviewData&&)' defaulted on its redeclaration with an exception-specification that differs from the implicit exception-specification '' 107 | PaintPreviewClient::PaintPreviewData::operator=( | ^~~~~~~~~~~~~~~~~~ Bug: 819294 Change-Id: I87b88a81e8af6b7e61f0d1a8c8444fd6707e50d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218168 Commit-Queue: Lei Zhang Reviewed-by: Lei Zhang Cr-Commit-Position: refs/heads/master@{#772348} --- diff --git a/base/files/file_path.cc b/base/files/file_path.cc index 6dc6854..56c02d2b 100644 --- a/base/files/file_path.cc +++ b/base/files/file_path.cc @@ -186,7 +186,7 @@ FilePath& FilePath::operator=(const FilePath& that) = default; -FilePath& FilePath::operator=(FilePath&& that) = default; +FilePath& FilePath::operator=(FilePath&& that) noexcept = default; bool FilePath::operator==(const FilePath& that) const { #if defined(FILE_PATH_USES_DRIVE_LETTERS) diff --git a/base/files/file_path.h b/base/files/file_path.h index 4e23f71a..2160fda 100644 --- a/base/files/file_path.h +++ b/base/files/file_path.h @@ -193,7 +193,7 @@ FilePath(FilePath&& that) noexcept; // Replaces the contents with those of |that|, which is left in valid but // unspecified state. - FilePath& operator=(FilePath&& that); + FilePath& operator=(FilePath&& that) noexcept; bool operator==(const FilePath& that) const;