On 8 April 2015 at 17:34, Mike Harrold wrote: > Posting this here because I can't figure out if the code is wrong (if > it is, it has to be something really stupidly simple...) or if the > error message is misleading. > > /** > */ > > #include <mutex> > > typedef unsigned int flag_t; > > class Data > { > private: > > std::mutex __M_lock; __M_lock is a reserved name, so your code has undefined behaviour. The same applies to most of the other names you've used. Don't use names reserved for the implementation. > template<typename T> > inline T > __set_flag(T& flag, const T& bits) noexcept > { return __manip_flag(flag, bits, __raw_set_flag<T>); } > > /* > template<typename T> > inline T > __clr_flag(T& flag, const T& bits) noexcept > { return __manip_flag(flag, bits, __raw_clr_flag); } __raw_clr_flag is a function template, you need to tell the compiler which specialization you want to use, i.e. __raw_clr_flag<T>. __raw_clr_flag is also a reserved name. Undefined behaviour.