From 1931db04cf4b3737adfb99edf86cbf68d740511b Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Thu, 20 Feb 2020 11:41:29 +0100 Subject: [PATCH] GNU stdc++: media::MediaError default constructor should be public On building with GNU stdc++ we get this error building: gen/media/mojo/mojom/media_types.mojom.cc:1161:55: required from here /usr/include/c++/9/bits/stl_construct.h:75:7: error: ‘media::MediaError::MediaError()’ is private within this context This is because the serialization code will eventually call, in this case, the default constructor because of the implementation of stl_uninitialized that is used to create an std::vector. This is invoked from static bool mojo::ArrayTraits >::Resize(std::vector<_Tp>&, size_t) and what it does is constructing a temporary vector like this: std::vector temp(size); But this is requiring calling the default constructor of T (in this case MediaError) for all the elements up to size-1. Bug: 957519 Change-Id: Ie3a28b9734f16c5155b9500003838510be0a748d --- diff --git a/media/base/media_error.h b/media/base/media_error.h index d3ba96c..56daaec 100644 --- a/media/base/media_error.h +++ b/media/base/media_error.h @@ -40,6 +40,9 @@ // successful returns. class MEDIA_EXPORT MediaError { public: + // Default constructor can be used for MediaError::Ok(); + MediaError(); + // Convenience function to return |kOk|. // OK won't have a message, trace, or data associated with them, and DCHECK // if they are added. @@ -110,9 +113,6 @@ } private: - // Default constructor can be used for MediaError::Ok(); - MediaError(); - // Private helper to add the current stack frame to the error trace. void AddFrame(const base::Location& location);