with the attached testcase, during linking you get:
test2.o:(.data+0x0): multiple definition of `_ZN3BadIT_E2_yE'
test1.o:(.data+0x0): first defined here
this comes from a template class:
template <class T>
class Bad {
static const int _y;
};
template <class T> const int Bad<T>::_y = 1023;
although this seems like a generic c++ problem, it was only observed on
hppa-linux and not on other platforms.
this test was simplified from a failure reported in building the quantlib
package against g++-4.1. With earlier g++ versions the package builds fine.
--
Summary: [4.1 regression] static const member in template class
leads to multiple definitions at linktime
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tausq at debian dot org
GCC build triplet: hppa-unknown-linux
GCC host triplet: hppa-unknown-linux
GCC target triplet: hppa-unknown-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28620