Commit e14b08c2 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Commit Bot

pref service: Include pref_hash_store.h in pref_hash_filter.h.

std::unique_ptr's default_delete expects a complete type for it to delete,
and we were only forward-declaring PrefHashStore in pref_hash_filter.h.

clang somehow works despite this, but GCC (tested 7.3.1) fails as expected:

    In file included from /usr/include/c++/7/memory:80:0,
                     from ../../services/preferences/tracked/pref_hash_filter.h:11,
                     from ../../services/preferences/tracked/tracked_split_preference.h:14,
                     from ../../services/preferences/tracked/tracked_split_preference.cc:5:
    /usr/include/c++/7/bits/unique_ptr.h: In instantiation of ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = PrefHashStore]’:
    /usr/include/c++/7/bits/unique_ptr.h:268:17:   required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = PrefHashStore; _Dp = std::default_delete<PrefHashStore>]’
    /usr/include/c++/7/bits/stl_pair.h:293:17:   required from ‘struct std::is_trivially_move_constructible<std::pair<std::unique_ptr<PrefHashStore>, std::unique_ptr<HashStoreContents> > >’
    ../../base/optional.h:290:22:   required from ‘class base::internal::OptionalBase<std::pair<std::unique_ptr<PrefHashStore>, std::unique_ptr<HashStoreContents> > >’
    ../../base/optional.h:416:7:   required from ‘class base::Optional<std::pair<std::unique_ptr<PrefHashStore>, std::unique_ptr<HashStoreContents> > >’
    ../../services/preferences/tracked/pref_hash_filter.h:142:37:   required from here
    /usr/include/c++/7/bits/unique_ptr.h:76:22: error: invalid application of ‘sizeof’ to incomplete type ‘PrefHashStore’
      static_assert(sizeof(_Tp)>0,
                          ^

Fix it by including the header instead of just forward-declaring the
class (which is already done for the other member of |StoreContentsPair|,
|HashStoreContents|).

Change-Id: I5a71e20c5a1330992610e26bdbf69d7f79b052dc
Reviewed-on: https://chromium-review.googlesource.com/948847Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#540840}
parent ab04d6a8
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "components/prefs/pref_store.h" #include "components/prefs/pref_store.h"
#include "services/preferences/public/cpp/tracked/pref_names.h" #include "services/preferences/public/cpp/tracked/pref_names.h"
#include "services/preferences/tracked/dictionary_hash_store_contents.h" #include "services/preferences/tracked/dictionary_hash_store_contents.h"
#include "services/preferences/tracked/pref_hash_store.h"
#include "services/preferences/tracked/pref_hash_store_transaction.h" #include "services/preferences/tracked/pref_hash_store_transaction.h"
#include "services/preferences/tracked/tracked_atomic_preference.h" #include "services/preferences/tracked/tracked_atomic_preference.h"
#include "services/preferences/tracked/tracked_split_preference.h" #include "services/preferences/tracked/tracked_split_preference.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment