net service: Fix GCC build after commit e366fe60

Commit e366fe60 ("Servicified custom DNS configuration") added code that
follows the following pattern:

    base::Optional<T> Foo() {
      T t;
      return t;
    }

clang seems to automatically convert |t| to an rvalue reference, but GCC
fails with:

In file included from /usr/include/c++/7/vector:62:0,
                 from ../../services/network/public/cpp/host_resolver_mojom_traits.h:10,
                 from ../../services/network/public/cpp/host_resolver_mojom_traits.cc:5:
/usr/include/c++/7/bits/stl_construct.h: In instantiation of ‘void std::_Construct(_T1*, _Args&& ...) [with _T1 = mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>; _Args = {const mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>&}]’:
/usr/include/c++/7/bits/stl_uninitialized.h:83:18:   required from ‘static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>*, std::vector<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> > >; _ForwardIterator = mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>*; bool _TrivialValueTypes = false]’
/usr/include/c++/7/bits/stl_uninitialized.h:134:15:   required from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>*, std::vector<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> > >; _ForwardIterator = mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>*]’
/usr/include/c++/7/bits/stl_uninitialized.h:289:37:   required from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>*, std::vector<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> > >; _ForwardIterator = mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>*; _Tp = mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>]’
/usr/include/c++/7/bits/stl_vector.h:331:31:   required from ‘std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>; _Alloc = std::allocator<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> >]’
../../base/optional.h:49:64:   required from ‘constexpr base::internal::OptionalStorageBase<T, <anonymous> >::OptionalStorageBase(base::in_place_t, Args&& ...) [with Args = {std::vector<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>, std::allocator<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> > >&}; T = std::vector<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> >; bool <anonymous> = false]’
../../base/optional.h:146:33:   required from ‘constexpr base::internal::OptionalBase<T>::OptionalBase(base::in_place_t, Args&& ...) [with Args = {std::vector<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer>, std::allocator<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> > >&}; T = std::vector<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> >]’
../../base/optional.h:518:67:   required from ‘constexpr base::Optional<T>::Optional(U&&) [with U = std::vector<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> >&; typename std::enable_if<(((std::is_constructible<T, U&&>::value && (! std::is_same<typename std::remove_cv<typename std::remove_reference<_SrcTuple>::type>::type, base::in_place_t>::value)) && (! std::is_same<typename std::remove_cv<typename std::remove_reference<_SrcTuple>::type>::type, base::Optional<T> >::value)) && std::is_convertible<U&&, T>::value), bool>::type <anonymous> = 0; T = std::vector<mojo::InlinedStructPtr<network::mojom::DnsOverHttpsServer> >]’
../../services/network/public/cpp/host_resolver_mojom_traits.cc:168:10:   required from here
/usr/include/c++/7/bits/stl_construct.h:75:7: error: ‘mojo::InlinedStructPtr<S>::InlinedStructPtr(const mojo::InlinedStructPtr<S>&) [with S = network::mojom::DnsOverHttpsServer]’ is private within this context
     { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Bug: 819294
Change-Id: Ic4233296aac5036131a43551eea7e7e8961ea1f8
Reviewed-on: https://chromium-review.googlesource.com/c/1298993
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#602888}
1 file changed