-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
This is a headache for users:
Lines 1508 to 1516 in 3141965
| #ifndef _ENABLE_ATOMIC_ALIGNMENT_FIX | |
| static_assert(alignof(_Ty) >= sizeof(_Ty) || (sizeof(_Ty) != 2 && sizeof(_Ty) != 4 && sizeof(_Ty) != 8), | |
| "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 |
As the message explains, VS 2015 RTW and VS 2015 Update 1 emitted an incorrect layout for this scenario, std::atomic<T> with sizeof(T) equal to 2/4/8 and alignof(T) < sizeof(T). Everything compiled with VS 2015 Update 2, VS 2015 Update 3 (the final update), VS 2017, and VS 2019 is immune to this problem.
Now that it's been almost 5 years, does it still make sense to require users to define this macro in order to compile Standard-conformant code? Do we have to worry about separately compiled OBJs/LIBs built with VS 2015 RTW/Update 1 still lurking out there? (Hopefully, this macro should have brought such code to someone's attention.)
I believe it's time to remove this check, but we need to make a decision.