This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gold incremental.cc gcc-9 compiler error
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Tulio Magno Quites Machado Filho <tuliom at ascii dot art dot br>
- Cc: Alan Modra <amodra at gmail dot com>, Binutils <binutils at sourceware dot org>
- Date: Sun, 8 Jul 2018 18:58:09 -0700
- Subject: Re: gold incremental.cc gcc-9 compiler error
- References: <20180601045655.GV23663@bubble.grove.modra.org> <20180601103206.GB7660@bubble.grove.modra.org> <CAJimCsE0Twif9W0SBGjE0VwBNM3gcFnMMEUDyBUV4PG_aNA15Q@mail.gmail.com> <CAJimCsHitz3NXF-daE7gSEV2Fgi0q6YS9uHWnX=Vd6GffbQSow@mail.gmail.com> <8736wwt8ms.fsf@linux.ibm.com>
Hmmm, according to:
https://gcc.gnu.org/projects/cxx-status.html#cxx11
GCC 4.8.1 is feature complete for C++ 11, so 5.4 should be fine. If
you compile with -std=c++11, does it compile clean? I guess I may need
to add that flag.
Does anyone know the earliest version of GCC that supports C++11
features by default?
-cary
On Fri, Jul 6, 2018 at 1:24 PM, Tulio Magno Quites Machado Filho
<tuliom@ascii.art.br> wrote:
> Hi,
>
> Cary Coutant <ccoutant@gmail.com> writes:
>
>> I've committed the following patch.
>>
>> Replacing push_back() with emplace_back() eliminates the calls to the
>> copy constructor, but I still had to provide explicit copy
>> constructors because of the call to vector::reserve(), which tries to
>> instantiate them even though they'll never actually be called when
>> reserve() is called on an empty vector.
>>
>> -cary
>>
>>
>> 2018-06-22 Cary Coutant <ccoutant@gmail.com>
>>
>> gold/
>> * incremental.cc (Sized_incremental_binary::setup_readers): Use
>> emplace_back for GCC 5 and later.
>> * incremental.h (Incremental_binary::Input_reader): Provide copy
>> constructor.
>> (Sized_incremental_binary::Sized_input_reader): Likewise.
>>
>> diff --git a/gold/incremental.cc b/gold/incremental.cc
>> index 21f060c945..7558d14ff5 100644
>> --- a/gold/incremental.cc
>> +++ b/gold/incremental.cc
>> @@ -311,7 +311,11 @@ 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);
>> +#if defined(__GNUC__) && __GNUC__ < 5
>> this->input_entry_readers_.push_back(Sized_input_reader(input_file));
>> +#else
>> + this->input_entry_readers_.emplace_back(input_file);
>> +#endif
>
> I noticed the following error after this patch:
>
> incremental.cc: In instantiation of ‘void gold::Sized_incremental_binary<size, big_endian>:
> :setup_readers() [with int size = 32; bool big_endian = false]’:
> binutils/gold/incremental.cc:3086:7: required from here
> binutils/gold/incremental.cc:317:7: error: ‘class std::vector<gold::Sized_incremental_binary<32, false>::Sized_input_reader, std::allocator<gold::Sized_incremental_binary<32, false>::Sized_input_reader> >’ has no member named ‘emplace_back’
> this->input_entry_readers_.emplace_back(input_file);
> ^
>
> I'm using gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10).
>
> --
> Tulio Magno