https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64163
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2014-12-04 Ever confirmed|0 |1 --- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Markus Trippelsdorf from comment #7) > Here is another reduced testcase. This time hopefully without and ODR issues. > > % cat qmimeglobpattern.ii > class A > { > public: > bool deref (); > }; > class QString; > struct B > { > A ref; > }; > template <typename> class QList > { > B d; > public: > ~QList (); > class const_iterator > { > }; > const_iterator constBegin (); > void clear (); > void dealloc (); > }; > template <typename T> QList<T>::~QList () > { > if (d.ref.deref ()) > dealloc (); > } > template <typename T> > void > QList<T>::clear () > { > QList (); > } > class A1 : public QList<QString> > { > }; > class B1 > { > public: > B1 (A1); > }; > struct F > { > void addMatch (const QString &&); > A1 m_matchingMimeTypes; > }; > class G > { > A1 matchingGlobs (const QString &) const; > }; > void > F::addMatch (const QString &&) > { > m_matchingMimeTypes.clear (); > } > A1 > G::matchingGlobs (const QString &) const > { > A1 a; > for (B1 b (a);;) > ; > } > > % cat qmimeprovider.ii > class A > { > public: > bool deref (); > }; > class QString; > struct B > { > A ref; > }; > template <typename> class QList > { > B d; > public: > ~QList (); > class const_iterator > { > }; > const_iterator constBegin (); > void clear (); > void dealloc (); > }; > > class C > { > QList<QString> c; > QList<QString>::const_iterator i; > > public: > C (QList<QString>) : i (c.constBegin ()) {} > }; > template <typename T> QList<T>::~QList () > { > if (d.ref.deref ()) > dealloc (); > } > > void > fn1 () > { > QList<QString> a; > C b (a); > } > > % g++ -fuse-ld=bfd -shared -fPIC -O3 -fvisibility=hidden -std=c++0x > qmimeglobpattern.ii qmimeprovider.ii > % g++ -fuse-ld=gold -shared -fPIC -O3 -fvisibility=hidden -std=c++0x > qmimeglobpattern.ii qmimeprovider.ii > /usr/bin/ld.gold: error: /tmp/ccRfiSrB.o: requires dynamic R_X86_64_PC32 > reloc against '_ZN5QListI7QStringED1Ev' which may overflow at runtime; > recompile with -fPIC > /tmp/ccRfiSrB.o:qmimeprovider.ii:function fn1(): warning: relocation refers > to discarded section > /tmp/ccRfiSrB.o:qmimeprovider.ii:function fn1(): warning: relocation refers > to discarded section > /tmp/ccRfiSrB.o:qmimeprovider.ii:function fn1(): warning: relocation refers > to discarded section > collect2: error: ld returned 1 exit status This is caused by r218024.