This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/28599] New: multiple definitions of static const member of template class
- From: "peter dot soetens at fmtc dot be" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Aug 2006 12:45:35 -0000
- Subject: [Bug c++/28599] New: multiple definitions of static const member of template class
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code snippet (from the boost::ublas library) :
template<class T1, class T2>
struct scalar_divides_assign {
static const bool computed ;
};
template<class T1, class T2>
const bool scalar_divides_assign<T1,T2>::computed = true;
gives a defined symbol in the .o file:
$ g++-4.1 -c Ublas.cpp -o Ublas.o; nm -C Ublas.o
00000000 D _ZN21scalar_divides_assignIT_T0_E8computedE
Which is not the case with g++-4.0 and older.
The user gets an "multiple definition of
`_ZN5boost7numeric5ublas21scalar_divides_assignIT_T0_E8computedE'"
error at link time.
--
Summary: multiple definitions of static const member of template
class
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peter dot soetens at fmtc dot be
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28599