Boost logo

Boost :

Subject: [boost] [boost.atomic] linker error with gcc 4.1.2
From: Jamie Allsop (ja11sop_at_[hidden])
Date: 2010-03-02 21:09:24

With gcc 4.1.2 (gcc 4.3.x is fine) I am seeing this linker error:

In function `void
multiple definition of `void
/thirdparty/boost/boost_1_42/boost/atomic/detail/gcc-x86.hpp:63: first
defined here

Which doesn't make a lot of sense at first glance, but on closer
inspection I see that:

boost/atomic/detail/base.hpp defines platform_atomic_thread_fence as:

template<typename T>
static inline void platform_atomic_thread_fence(T order)
        /* FIXME: this does not provide
        sequential consistency, need one global
        variable for that... */
        platform_atomic<int> a;, order);

and then it is defined as a specialisation in:

boost/atomic/detail/gcc-x86.hpp as:

void platform_atomic_thread_fence(memory_order order)
        switch(order) {
                case memory_order_seq_cst:
                case memory_order_acquire:
                case memory_order_consume:
                case memory_order_acq_rel:
                case memory_order_release:
                        __asm__ __volatile__ ("" ::: "memory");

Is this a compiler error or should the specialisation be declared as:

inline void platform_atomic_thread_fence(memory_order order)

(which will work)


Boost list run by bdawes at, gregod at, cpdaniel at, john at