https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93059
--- Comment #41 from fdlbxtqi <euloanty at live dot com> --- (In reply to Jonathan Wakely from comment #38) > We could also use memcmp for std::equal when it's using std::equal_to<> or > std::equal_to<_ValueType1> or std::equal_to<_ValueType2>, and for > std::lexicographical_compare when it's using std::less<> or > std::less<_ValueType1> or std::less<_ValueType2> (as long as the existing > conditions are also met). > > Currently we only use memcmp when those algos are used without a comparison > function. And the volatile bugs haven't fixed either. The code works fine in GCC 9.0. Now it failed to work. Even I swap the standard to C++17, it still does not work. Does deprecate volatile work in this case in C++20?? However, even that is the case, C++17 should still work. #include<array> auto f(std::array<int volatile,3> arr) { decltype(arr) arr2; std::copy(arr.begin(),arr.end(),arr2.begin()); } https://godbolt.org/z/Tn87r5