aboutsummaryrefslogtreecommitdiffstats
path: root/chromium/chromium/chromium-gcc9-r772175.patch
blob: 3ebbb98946b4040cbcc829bce3bf7cc637115eaf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
From 911bdcd8cc5475be4ec4228cfbc85fc38f52857e Mon Sep 17 00:00:00 2001
From: Stephan Hartmann <stha09@googlemail.com>
Date: Wed, 27 May 2020 10:00:41 +0000
Subject: [PATCH] GCC: make base::{flat_map,flat_tree} move assignement
 operators noexcept
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Move assigment operator in ui::ColorSet is noexcept. Because this
class has a member of type base::flat_map, move assignment operators
of base::flat_map and base::flat_tree must be noexcept too.
base::flat_tree noexcept is conditional to avoid build failure with
NaCl.

Otherwise GCC fails like this:

../../ui/color/color_set.cc:14:11: error: function
'ui::ColorSet& ui::ColorSet::operator=(ui::ColorSet&&)' defaulted on its
redeclaration with an exception-specification that differs from the
implicit exception-specification ''
   14 | ColorSet& ColorSet::operator=(ColorSet&&) noexcept = default;
      |           ^~~~~~~~

Bug: 819294
Change-Id: I10ce31851effc9ce78f2b5cbbb7148c339f065a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2179245
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772175}
---
 base/containers/flat_map.h  | 2 +-
 base/containers/flat_tree.h | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/base/containers/flat_map.h b/base/containers/flat_map.h
index ed82c5d516c8..1af6b407a52d 100644
--- a/base/containers/flat_map.h
+++ b/base/containers/flat_map.h
@@ -202,7 +202,7 @@ class flat_map : public ::base::internal::flat_tree<
   ~flat_map() = default;
 
   flat_map& operator=(const flat_map&) = default;
-  flat_map& operator=(flat_map&&) = default;
+  flat_map& operator=(flat_map&&) noexcept = default;
   // Takes the first if there are duplicates in the initializer list.
   flat_map& operator=(std::initializer_list<value_type> ilist);
 
diff --git a/base/containers/flat_tree.h b/base/containers/flat_tree.h
index 9412ff6af749..ce6e92b4d363 100644
--- a/base/containers/flat_tree.h
+++ b/base/containers/flat_tree.h
@@ -125,7 +125,8 @@ class flat_tree {
   // Assume that move assignment invalidates iterators and references.
 
   flat_tree& operator=(const flat_tree&);
-  flat_tree& operator=(flat_tree&&);
+  flat_tree& operator=(flat_tree&&) noexcept(
+      std::is_nothrow_move_assignable<underlying_type>::value);
   // Takes the first if there are duplicates in the initializer list.
   flat_tree& operator=(std::initializer_list<value_type> ilist);
 
@@ -518,7 +519,9 @@ auto flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::operator=(
     const flat_tree&) -> flat_tree& = default;
 
 template <class Key, class Value, class GetKeyFromValue, class KeyCompare>
-auto flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::operator=(flat_tree &&)
+auto flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::
+operator=(flat_tree&&) noexcept(
+    std::is_nothrow_move_assignable<underlying_type>::value)
     -> flat_tree& = default;
 
 template <class Key, class Value, class GetKeyFromValue, class KeyCompare>
-- 
2.26.2