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

            Bug ID: 87051
           Summary: is_trivially_move_constructible wrongly gives `false`
                    for class with user-provided non-const copy
                    constructor
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur.j.odwyer at gmail dot com
  Target Milestone: ---

cat > test.cc <<EOF
struct M {
    M(M&);
    M(const M&) = default;
};
static_assert( __is_trivially_constructible(M, M&&) );
EOF
g++ -std=c++17 test.cc

GCC fails the static-assert:

test.cc:5:16: error: static assertion failed
static_assert( __is_trivially_constructible(M, M&&) );
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Comparison to other compilers: https://godbolt.org/z/mbeKD5

Verification that the codegen for a move-construction correctly picks the
trivial constructor, not the non-trivial one: https://godbolt.org/z/IBkgPY

Reply via email to