Hello,
What error are you getting?
VC++ 2015 emits a syntax error:
void f() {
boost::lockfree::queue queue;
queue.reserve(10);
}
1>boost\lockfree\queue.hpp(226): error C2059: syntax error: 'template'
I figured out this is because of the "boost::lockfree::fixed_sized<true>" option. If I removed it, it compiles fine. So I managed to set the size of my queue at construction time.
Do you think it would be possible to improve the error message?
=== Bonus! ===
I was using VC++ 2015 Update 1, and I just updated to Update 2... and I get another error from std::atomic:
#ifndef _ENABLE_ATOMIC_ALIGNMENT_FIX
static_assert(alignof(_Ty) >= alignof(_My_int),
"You've instantiated std::atomic<T> with sizeof(T) equal to 2/4/8 and alignof(T) < sizeof(T). "
"Before VS 2015 Update 2, this would have misbehaved at runtime. "
"VS 2015 Update 2 was fixed to handle this correctly, "
"but the fix inherently changes layout and breaks binary compatibility. "
"Please define _ENABLE_ATOMIC_ALIGNMENT_FIX to acknowledge that you understand this, "
"and that everything you're linking has been compiled with VS 2015 Update 2 (or later).");
#endif /* _ENABLE_ATOMIC_ALIGNMENT_FIX */
This is caused by the following code in boost\lockfree\detail\freelist.hpp(603):
std::atomicboost::lockfree::detail::tagged_index pool_;
with sizeof(tagged_index) == 4 and alignof(tagged_index) == 2.
It can be fixed by changing tagged_index to be alignas(4), or by defining _ENABLE_ATOMIC_ALIGNMENT_FIX:
#if _MSC_FULL_VER == 190023918 // VC++ 2015 Update 2
#define _ENABLE_ATOMIC_ALIGNMENT_FIX
#endif
Since there's a compiler bug prior to Update 2 (https://connect.microsoft.com/VisualStudio/feedback/details/1892487/code-gen...), may be the source should be updated to not compile if the code generated by VC++ is not reliable?
Regards,
Aurélien Regat-Barrel