[Bug c++/64489] New: A simple struct wrapping a const int is not trivially copyable

ville.voutilainen at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jan 4 19:00:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64489

            Bug ID: 64489
           Summary: A simple struct wrapping a const int is not trivially
                    copyable
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ville.voutilainen at gmail dot com
                CC: jason at redhat dot com

struct X {const int val;};
static_assert(__is_trivially_copyable(const int), "");
static_assert(__is_trivially_copyable(X), "");

The second assertion fails. It shouldn't, because const int has
no non-trivial copy/move constructors or assignment operators, and
the first assertion succeeds. Clang accepts the code.



More information about the Gcc-bugs mailing list