https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90531
Bug ID: 90531
Summary: is_trivailly_copyable_v<volatile int[5]> should be
'true'
Product: gcc
Version: 9.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: alisdairm at me dot com
Target Milestone: ---
This is a tale of woe in the standard, but boils down to the following simple
test program, which compiles and passes with the current Microsoft and Clang
compiler/library combinations:
#include <type_traits>
int main()
{
static_assert( std::is_trivially_copyable_v< int[5]>);
static_assert( std::is_trivially_copyable_v<volatile int[5]>); // valid?
}
The line marked '// valid?' fails only for libstdc++.
Doing a standards dive, there were a couple of core issues for C++11 and C++14
that mandate libstdc++'s interpretation. However, Core Defect 2094 reversed
that decision for C++17:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2094
This appears to have been adopted as a DR against C++14 at the November 2016
meeting.
While I am filing as a library bug, I suspect the issue is actually an
intrinsic in the compiler, and may extend to the compiler's treatment of
volatile scalars and arrays.