Commit b47d1d90 by Jason Merrill Committed by Jason Merrill

* method.c (synthesized_method_walk): operator= can also be constexpr.

From-SVN: r233956
parent a0a6a8c9
2016-03-03 Jason Merrill <jason@redhat.com>
* method.c (synthesized_method_walk): operator= can also be constexpr.
* pt.c (tsubst_copy_and_build) [LAMBDA_EXPR]: Get
LAMBDA_EXPR_RETURN_TYPE from the instantiated closure.
......
......@@ -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)
......
// { dg-do compile { target c++14 } }
struct A { };
struct B
{
A a;
constexpr B& operator=(const B&) = default;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment