diff options
author | Jason Merrill <jason@redhat.com> | 2016-03-03 20:48:33 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-03-03 20:48:33 -0500 |
commit | b47d1d904d5397a61bba40fba095f02bd00f04c1 (patch) | |
tree | ec818ef2328018e59c1c66218c5d2528001657ad /gcc/cp/method.c | |
parent | a0a6a8c9662c1aeae0d1c2a63bc45a0a8242b43b (diff) | |
download | gcc-b47d1d904d5397a61bba40fba095f02bd00f04c1.zip gcc-b47d1d904d5397a61bba40fba095f02bd00f04c1.tar.gz gcc-b47d1d904d5397a61bba40fba095f02bd00f04c1.tar.bz2 |
* method.c (synthesized_method_walk): operator= can also be constexpr.
From-SVN: r233956
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r-- | gcc/cp/method.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 0235e6a..38f2a54 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1379,9 +1379,18 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, /* If that user-written default constructor would satisfy the requirements of a constexpr constructor (7.1.5), the - implicitly-defined default constructor is constexpr. */ + implicitly-defined default constructor is constexpr. + + The implicitly-defined copy/move assignment operator is constexpr if + - X is a literal type, and + - the assignment operator selected to copy/move each direct base class + subobject is a constexpr function, and + - for each non-static data member of X that is of class type (or array + thereof), the assignment operator selected to copy/move that member is a + constexpr function. */ if (constexpr_p) - *constexpr_p = ctor_p; + *constexpr_p = ctor_p + || (assign_p && cxx_dialect >= cxx14); move_p = false; switch (sfk) |