The following code prints whether std::atomic<bool>
is trivially copyable:
#include <atomic>
#include <iostream>
#include <type_traits>
int main(){
std::cout << std::is_trivially_copyable_v<std::atomic<bool>> << "\n";
}
It gives the following result on gcc and clang:
1
But on MSVC the result is:
0
The behavior of all 3 compilers is also demonstrated here using static_assert
.
I thought that trivial copyablity is defined either way by the standard.
Which compiler is right (or is it implementation specific) ?