https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71116
Bug ID: 71116 Summary: Lambdas should not be literal types Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eric.niebler at gmail dot com Target Milestone: --- #include <type_traits> template <class Fn> void oops(Fn) { static_assert(!std::is_literal_type<Fn>::value, "oops"); } int main() { oops([]{}); } Yields: test.cpp: In instantiation of ‘void oops(Fn) [with Fn = main()::<lambda()>]’: test.cpp:9:12: required from here test.cpp:5:3: error: static assertion failed: oops static_assert(!std::is_literal_type<Fn>::value, "oops"); ^~~~~~~~~~~~~ ([expr.prim.lambda]/p3) "The type of the lambda-expression (which is also the type of the closure object) is a unique, unnamed non-union class type — called the closure type — whose properties are described below. This class type is neither an aggregate (8.5.1) nor a literal type (3.9)."