(This is not a duplicate of another question since in the other one the question is about the compilation issue (where somebody suggested to implement a constructor), and here there is an specific question about how to implement that constructor manually)
In order to compile the following program with GCC 4.9.2, It has to be modified. I have to implement the constructor manually and I dont know how to do it.
The line 6 is causing trouble and is the one that needs to be modified: 'TabStats::TabStats(TabStats&& other) noexcept = default;'
As a condition, the no-except specifier cant be removed.
SOURCE CODE:
#include "browser/resource_coordinator/tab_stats.h"
#include "build/build_config.h"
namespace resource_coordinator {
TabStats::TabStats() = default;
TabStats::TabStats(const TabStats& other) = default;
TabStats::TabStats(TabStats&& other) noexcept = default;
TabStats::~TabStats() {}
TabStats& TabStats::operator=(const TabStats& other) = default;
} // namespace resource_coordinator
tab_stats.h is included below:
#ifndef BROWSER_RESOURCE_COORDINATOR_TAB_STATS_H_
#define BROWSER_RESOURCE_COORDINATOR_TAB_STATS_H_
#include <stdint.h>
#include <vector>
#include "base/process/process.h"
#include "base/strings/string16.h"
#include "base/time/time.h"
#include "build/build_config.h"
namespace content {
class RenderProcessHost;
} // namespace content
namespace resource_coordinator {
struct TabStats {
TabStats();
TabStats(const TabStats& other);
TabStats(TabStats&& other) noexcept;
~TabStats();
TabStats& operator=(const TabStats& other);
bool is_app = false; // Browser window is an app.
bool is_internal_page = false; // Internal page, such as NTP or Settings.
// Playing audio, accessing cam/mic or mirroring display.
bool is_media = false;
bool is_pinned = false;
bool is_in_visible_window = false;
bool is_in_active_window = false;
// Whether this is the active tab in a browser window.
bool is_active = false;
bool is_discarded = false;
// User has entered text in a form.
bool has_form_entry = false;
int discard_count = 0;
bool has_beforeunload_handler = false;
base::TimeTicks last_active;
base::TimeTicks last_hidden;
content::RenderProcessHost* render_process_host = nullptr;
base::ProcessHandle renderer_handle = 0;
int child_process_host_id = 0;
base::string16 title;
#if defined(OS_CHROMEOS)
int oom_score = 0;
#endif
int64_t tab_contents_id = 0; // Unique ID per WebContents.
bool is_auto_discardable = true;
};
typedef std::vector<TabStats> TabStatsList;
} // namespace resource_coordinator
#endif // BROWSER_RESOURCE_COORDINATOR_TAB_STATS_H_
This is the compilation error Im getting (I removed many flags to make this shorter):
[20689/29018] CXX obj/chrome/browser/browser/tab_stats.o
FAILED: obj/chrome/browser/browser/tab_stats.o
g++ -MMD -MF obj/chrome/browser/browser/tab_stats.o.d -DUSE_LIBSECRET -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DNO_TCMALLOC -DDISABLE_NACL -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DNDEBUG -DUSE_CUPS -DUSE_GNOME_KEYRING -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DUSE_GLX -DSK_SUPPORT_GPU=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DHUNSPELL_STATIC --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -pthread -m32 -msse2 -mfpmath=sse -mmmx -Wall -O2 -g0 -fvisibility=hidden -DLIBXML_STATIC= -std=gnu++11 -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include -Wno-narrowing -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -c ../../chrome/browser/resource_coordinator/tab_stats.cc -o obj/chrome/browser/browser/tab_stats.o
../../chrome/browser/resource_coordinator/tab_stats.cc:14:1: error: function 'resource_coordinator::TabStats::TabStats(resource_coordinator::TabStats&&)' defaulted on its redeclaration with an exception-specification that differs from the implicit declaration 'resource_coordinator::TabStats::TabStats(resource_coordinator::TabStats&&)'
TabStats::TabStats(TabStats&& other) noexcept = default;
^