A patch for gcc-7.2 to implement abbreviated lambdas to C++
The patch aims at implementing the proposals:
You can try the compiler live [no longer available].
I'm hosting a ubuntu build of the compiler on a Amazon EC2 server and running compiler explorer on it.
- adds an abbreviated syntax for lambdas and function/members [OK]
- uses decltype((ret_expr)) as deduced return type when used [OK]
- uses noexcept(noexcept(ret_expr)) as deduced exception specification [OK]
- optional type for lambda's arguments [OK]
- >>x exacltly equivalent to static_cast<decltype(x)&&>(x) [OK]
[](auto&&x) => func(>>x); /*or*/ [](x) => func(>>x);
//will be equivalent to
[](auto&& x)
noexcept(noexcept(func(std::forward<decltype(x)&&>(x))))
-> decltype((func(std::forward<decltype(x)&&>(x))))
{
return func(std::forward<decltype(x)&&>(x));
};
template<class T>
constexpr auto f(T&& x) => x; //allowed with functions too
[](x...) {}; //same as [](auto&&... x) {}
Simply run make, sit back and wait. It will:
- download gcc-7.2
- apply the patches
- configure gcc
- compile gcc
- install gcc in $(PWD)/gcc/install/
- compile test.cpp with the new g++.
By default gcc will be configured with the following options:
- --disable-bootstrap //build gcc using the produced gcc
- --disable-multilib //cross-compiling
- --disable-shared //doesn't build shared standard library Simply remove them from the gcc/build command from Makefile if you want to change the default behavior.