This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/28599] New: multiple definitions of static const member of template class


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]