[GOLD] powerpc64 ODR violation check

Ian Lance Taylor iant@google.com
Sat Mar 9 02:06:00 GMT 2013


On 3/7/13, Alan Modra <amodra@gmail.com> wrote:
> On Thu, Mar 07, 2013 at 10:09:23PM -0800, Ian Lance Taylor wrote:
>> On 3/7/13, Alan Modra <amodra@gmail.com> wrote:
>>
>> > - Moving find_shdr to Object requires specifying template parameters
>> > explicitly since the arguments don't allow a compiler to deduce them.
>> > I didn't know how to do that using this->find_shdr() syntax, or if it
>> > is even possible.
>>
>> You just write
>>     this->find_shdr<size, big_endian>(...)
>> Do that instead of the Object::find_shdr approach.
>
> I tried that.  This with gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1.
> Ditto for gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
>
> /src/binutils-current/gold/object.cc: In member function ‘bool
> gold::Sized_relobj_file<size, big_endian>::find_eh_frame(const unsigned
> char*, const char*, gold::section_size_type) const’:
> /src/binutils-current/gold/object.cc:590:30: error: ISO C++ forbids
> comparison between pointer and integer [-fpermissive]
> /src/binutils-current/gold/object.cc: In member function ‘bool
> gold::Sized_relobj_file<size, big_endian>::find_eh_frame(const unsigned
> char*, const char*, gold::section_size_type) const [with int size = 32, bool
> big_endian = false, gold::section_size_type = long unsigned int]’:
> /src/binutils-current/gold/object.cc:3209:7:   instantiated from here
> /src/binutils-current/gold/object.cc:589:7: error: left operand of comma
> operator has no effect [-Werror=unused-value]
> /src/binutils-current/gold/object.cc:589:7: error: right operand of comma
> operator has no effect [-Werror=unused-value]
> /src/binutils-current/gold/object.cc:589:7: error: right operand of comma
> operator has no effect [-Werror=unused-value]
> /src/binutils-current/gold/object.cc:589:7: error: right operand of comma
> operator has no effect [-Werror=unused-value]
> /src/binutils-current/gold/object.cc:589:7: error: invalid operands of types
> ‘<unresolved overloaded function type>’ and ‘int’ to binary ‘operator<’

That is peculiar.  Can you try this test program?  If this works, how
is it different from the code you wrote?

Ian

class C
{
 protected:
  template<typename i>
  int fn();
};

class D : C
{
  int
  x()
  {
    return this->fn<int>();
  }
};



More information about the Binutils mailing list