This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gold incremental.cc gcc-9 compiler error


On Fri, Jun 01, 2018 at 02:26:55PM +0930, Alan Modra wrote:
> Using gcc-9 git commit 4c9d340c8 (svn 261051) to compile current
> binutils master.
> 
> /home/alan/src/binutils-gdb/gold/incremental.h:1704:9: error: implicitly-declared ‘constexpr gold::Incremental_binary::Input_reader::Input_reader(const gold::Incremental_binary::Input_reader&)’ is deprecated [-Werror=deprecated-copy]

Perhaps this?

Avoid copy constructor in Sized_incremental_binary::setup_readers

	* incremental.h (Sized_incremental_binary::input_entry_readers_):
	Make it a vector of pointers.
	(Sized_incremental_binary::do_get_input_reader): Adjust to suit.
	* incremental.cc (Sized_incremental_binary::setup_readers):
	Likewise.

diff --git a/gold/incremental.cc b/gold/incremental.cc
index 21f060c945..25061422da 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -311,7 +311,8 @@ Sized_incremental_binary<size, big_endian>::setup_readers()
   for (unsigned int i = 0; i < count; i++)
     {
       Input_entry_reader input_file = inputs.input_file(i);
-      this->input_entry_readers_.push_back(Sized_input_reader(input_file));
+      Sized_input_reader* sir = new Sized_input_reader(input_file);
+      this->input_entry_readers_.push_back(sir);
       switch (input_file.type())
 	{
 	case INCREMENTAL_INPUT_OBJECT:
@@ -321,9 +322,8 @@ Sized_incremental_binary<size, big_endian>::setup_readers()
 	  break;
 	case INCREMENTAL_INPUT_ARCHIVE:
 	  {
-	    Incremental_library* lib =
-		new Incremental_library(input_file.filename(), i,
-					&this->input_entry_readers_[i]);
+	    Incremental_library* lib
+	      = new Incremental_library(input_file.filename(), i, sir);
 	    this->library_map_[i] = lib;
 	    unsigned int member_count = input_file.get_member_count();
 	    for (unsigned int j = 0; j < member_count; j++)
diff --git a/gold/incremental.h b/gold/incremental.h
index 1c3fbe1147..01313c8c2b 100644
--- a/gold/incremental.h
+++ b/gold/incremental.h
@@ -1748,7 +1748,7 @@ class Sized_incremental_binary : public Incremental_binary
   do_get_input_reader(unsigned int n) const
   {
     gold_assert(n < this->input_entry_readers_.size());
-    return &this->input_entry_readers_[n];
+    return this->input_entry_readers_[n];
   }
 
  private:
@@ -1804,7 +1804,7 @@ class Sized_incremental_binary : public Incremental_binary
   Incremental_symtab_reader<big_endian> symtab_reader_;
   Incremental_relocs_reader<size, big_endian> relocs_reader_;
   Incremental_got_plt_reader<big_endian> got_plt_reader_;
-  std::vector<Sized_input_reader> input_entry_readers_;
+  std::vector<Sized_input_reader*> input_entry_readers_;
 };
 
 // An incremental Relobj.  This class represents a relocatable object


-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]