User account creation filtered due to spam.

Bug 28599 - multiple definitions of static const member of template class
Summary: multiple definitions of static const member of template class
Status: RESOLVED DUPLICATE of bug 28016
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-04 12:45 UTC by Peter Soetens
Modified: 2006-08-04 15:10 UTC (History)
12 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Soetens 2006-08-04 12:45:35 UTC
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.
Comment 1 Martin Michlmayr 2006-08-04 13:50:10 UTC
This is a duplicate of PR28016, which has been fixed already.  What version of the compiler are you using exactly?
Comment 2 Peter Soetens 2006-08-04 14:02:27 UTC
(In reply to comment #1)
> This is a duplicate of PR28016, which has been fixed already.  What version of
> the compiler are you using exactly?
> 

Ubuntu edgy package.

$ g++-4.1 --version
g++-4.1 (GCC) 4.1.2 20060708 (prerelease) (Ubuntu 4.1.1-8ubuntu1)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Same behaviour was reported on a mailinglist for a Debian version.
Comment 3 Martin Michlmayr 2006-08-04 15:10:23 UTC
Has been fixed in Debian and upstream already.  Please talk to your vendor.


*** This bug has been marked as a duplicate of 28016 ***