This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71116] New: Lambdas should not be literal types
- From: "eric.niebler at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 14 May 2016 19:27:19 +0000
- Subject: [Bug c++/71116] New: Lambdas should not be literal types
- Auto-submitted: auto-generated
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)."