2017-05-09 Jason Merrill <jason@redhat.com>
+ PR c++/70979 - literal class and closure types
+ * class.c (finalize_literal_type_property): Handle closures
+ specifically.
+ (explain_non_literal_class): Likewise.
+
PR c++/66297, DR 1684 - literal class and constexpr member fns
* constexpr.c (is_valid_constexpr_fn): Only complain about
non-literal enclosing class in C++11.
if (cxx_dialect < cxx11
|| TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
CLASSTYPE_LITERAL_P (t) = false;
+ else if (CLASSTYPE_LITERAL_P (t) && LAMBDA_TYPE_P (t))
+ CLASSTYPE_LITERAL_P (t) = (cxx_dialect >= cxx1z);
else if (CLASSTYPE_LITERAL_P (t) && !TYPE_HAS_TRIVIAL_DFLT (t)
&& CLASSTYPE_NON_AGGREGATE (t)
&& !TYPE_HAS_CONSTEXPR_CTOR (t))
return;
inform (0, "%q+T is not literal because:", t);
- if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
+ if (cxx_dialect < cxx1z && LAMBDA_TYPE_P (t))
+ inform (0, " %qT is a closure type, which is only literal in "
+ "C++1z and later", t);
+ else if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
inform (0, " %q+T has a non-trivial destructor", t);
else if (CLASSTYPE_NON_AGGREGATE (t)
&& !TYPE_HAS_TRIVIAL_DFLT (t)
+ && !LAMBDA_TYPE_P (t)
&& !TYPE_HAS_CONSTEXPR_CTOR (t))
{
inform (0, " %q+T is not an aggregate, does not have a trivial "