2014-10-10 Jason Merrill <jason@redhat.com>
+ * method.c (implicitly_declare_fn): Handle deleted lambda default
+ ctor and copy assop here.
+ * class.c (check_bases_and_members): Not here.
+ (add_implicitly_declared_members): And don't set
+ CLASSTYPE_LAZY_MOVE_ASSIGN.
+
* semantics.c (finish_id_expression): Check for error_mark_node.
2014-10-09 Jason Merrill <jason@redhat.com>
TYPE_HAS_COPY_ASSIGN (t) = 1;
TYPE_HAS_CONST_COPY_ASSIGN (t) = !cant_have_const_assignment;
CLASSTYPE_LAZY_COPY_ASSIGN (t) = 1;
- if (move_ok)
+ if (move_ok && !LAMBDA_TYPE_P (t))
CLASSTYPE_LAZY_MOVE_ASSIGN (t) = 1;
}
if (LAMBDA_TYPE_P (t))
{
- /* "The closure type associated with a lambda-expression has a deleted
- default constructor and a deleted copy assignment operator." */
- TYPE_NEEDS_CONSTRUCTING (t) = 1;
- TYPE_HAS_COMPLEX_DFLT (t) = 1;
- TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1;
- CLASSTYPE_LAZY_MOVE_ASSIGN (t) = 0;
-
/* "This class type is not an aggregate." */
CLASSTYPE_NON_AGGREGATE (t) = 1;
}
DECL_DEFAULTED_FN (fn) = 1;
if (cxx_dialect >= cxx11)
{
+ /* "The closure type associated with a lambda-expression has a deleted
+ default constructor and a deleted copy assignment operator." */
+ if ((kind == sfk_constructor
+ || kind == sfk_copy_assignment)
+ && LAMBDA_TYPE_P (type))
+ deleted_p = true;
DECL_DELETED_FN (fn) = deleted_p;
DECL_DECLARED_CONSTEXPR_P (fn) = constexpr_p;
}
--- /dev/null
+// { dg-do compile { target c++11 } }
+
+#define SA(X) static_assert((X),#X)
+
+void f()
+{
+ int x;
+ auto l = [=]{ return x; };
+ typedef decltype(l) C;
+ SA(__is_trivially_copyable(C));
+ SA(__is_trivially_constructible(C,C));
+}