I have a std::atomic which contains a pointer to a member function. Everything compiles fine in g++ 4.4.5, but I get this error during linking:
./pool.o: In function `pool::worker::worker(pool&, int, int)':
pool.cpp:(.text._ZN4pool6workerC1ERS_ii[pool::worker::worker(pool&, int, int)]+0x95): undefined reference to `std::atomic<void (pool::* const*)(unsigned int, unsigned int, pool::worker*)>::store(void (pool::* const*)(unsigned int, unsigned int, pool::worker*), std::memory_order) volatile'
./pool.o: In function `pool::worker::give_job(void (pool::* const&)(unsigned int, unsigned int, pool::worker*), unsigned int, unsigned int)':
pool.cpp:(.text._ZN4pool6worker8give_jobERKMS_FvjjPS0_Ejj[pool::worker::give_job(void (pool::* const&)(unsigned int, unsigned int, pool::worker*), unsigned int, unsigned int)]+0x142): undefined reference to `std::atomic<void (pool::* const*)(unsigned int, unsigned int, pool::worker*)>::store(void (pool::* const*)(unsigned int, unsigned int, pool::worker*), std::memory_order) volatile'
./pool.o: In function `pool::worker::soul()':
pool.cpp:(.text._ZN4pool6worker4soulEv[pool::worker::soul()]+0xf1): undefined reference to `std::atomic<void (pool::* const*)(unsigned int, unsigned int, pool::worker*)>::store(void (pool::* const*)(unsigned int, unsigned int, pool::worker*), std::memory_order) volatile'
I don’t really undertand why it’s trying to link to the volatile overloads of store(), where in the source the pointer to the member function is const, not volatile (and it compiles).
The same code compiles with g++ 4.6.3
Simple: GCC 4.4 didn’t have support for this or it is broken in the way you experienced. Newer GCC has better support and it works like it should.