• Raphael Kubo da Costa's avatar
    flat_map: Readd constructors and assignment operator overloads. · 1131840b
    Raphael Kubo da Costa authored
    https://chromium-review.googlesource.com/c/chromium/src/+/705955 ("base::flat_map
    was missing defaults for duplication handling") removed them in favor of
    inheriting them from flat_tree.
    
    This can cause problems with GCC due to
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84782, and the build has been
    failing with it since
    https://chromium-review.googlesource.com/1000393 ("Mojo C++ Bindings:
    unordered_map => flat_map") with a message like this:
    
        gen/mojo/public/interfaces/bindings/tests/test_unions.mojom.cc: In member function ‘void mojo::test::ObjectUnion::set_f_map_int8(const base::flat_map<std::__cxx11::basic_string<char>, signed char>&)’:
        gen/mojo/public/interfaces/bindings/tests/test_unions.mojom.cc:455:30: error: use of deleted function ‘base::flat_map<std::__cxx11::basic_string<char>, signed char>::flat_map(const base::flat_map<std::__cxx11::basic_string<char>, signed char>&)’
                 std::move(f_map_int8));
                                      ^
        In file included from ../../mojo/public/cpp/bindings/clone_traits.h:11:0,
                         from gen/mojo/public/interfaces/bindings/tests/test_unions.mojom.h:22,
                         from gen/mojo/public/interfaces/bindings/tests/test_unions.mojom.cc:15:
        ../../base/containers/flat_map.h:152:7: note: ‘base::flat_map<std::__cxx11::basic_string<char>, signed char>::flat_map(const base::flat_map<std::__cxx11::basic_string<char>, signed char>&)’ is implicitly declared as deleted because ‘base::flat_map<std::__cxx11::basic_string<char>, signed char>’ declares a move constructor or move assignment operator
         class flat_map : public ::base::internal::flat_tree<
               ^~~~~~~~
    
    Work around it by replacing the inheritance statements with actual
    constructors and operator=() overloads again. This change does not
    completely revert https://chromium-review.googlesource.com/1000393, as the
    constructors maintain their new signature (so that they look like
    flat_tree's).
    
    Bug: 819294, 837221
    Change-Id: I8f37a2c8aa269b3c1025cdc009518a7709e95947
    Reviewed-on: https://chromium-review.googlesource.com/1038103
    Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
    Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avatarkylechar <kylechar@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#556168}
    1131840b
flat_map.h 13.3 KB