Bug 87051 - is_trivially_move_constructible wrongly gives `false` for class with user-provided non-const copy constructor
Summary: is_trivially_move_constructible wrongly gives `false` for class with user-pro...
Status: ASSIGNED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Marek Polacek
URL:
Keywords: accepts-invalid, rejects-valid
Depends on:
Blocks:
 
Reported: 2018-08-21 22:12 UTC by Arthur O'Dwyer
Modified: 2018-12-23 15:18 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-08-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur O'Dwyer 2018-08-21 22:12:25 UTC
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
Comment 1 Ville Voutilainen 2018-08-21 23:33:14 UTC
I'll take a look.
Comment 2 Ville Voutilainen 2018-09-13 07:39:31 UTC
Patch available: https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00670.html