Commit 55067169 by Paolo Carlini Committed by Paolo Carlini

re PR c++/64227 (Forwarding an argument of a function template to a generic…

re PR c++/64227 (Forwarding an argument of a function template to a generic lambda causes a compiler crash)

2015-03-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/64227
	* g++.dg/cpp1y/lambda-generic-ice1.C: New.

From-SVN: r221181
parent 203876fc
2015-03-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/64227
* g++.dg/cpp1y/lambda-generic-ice1.C: New.
2015-03-04 James Greenhalgh <james.greenhalgh@arm.com> 2015-03-04 James Greenhalgh <james.greenhalgh@arm.com>
* gcc.target/aarch64/atomic-comp-swap-release-acquire.c: Add * gcc.target/aarch64/atomic-comp-swap-release-acquire.c: Add
......
// PR c++/64227
// { dg-do compile { target c++14 } }
template<typename T>
struct remove_reference
{ typedef T type; };
template<typename T>
struct remove_reference<T&>
{ typedef T type; };
template<typename T>
struct remove_reference<T&&>
{ typedef T type; };
template<typename T>
constexpr T&&
forward(typename remove_reference<T>::type& t) noexcept
{ return static_cast<T&&>(t); }
template<typename T>
constexpr T&&
forward(typename remove_reference<T>::type&& t) noexcept
{ return static_cast<T&&>(t); }
template<typename T>
auto greater_than(T&& t)
{
return [val = forward<T&&>(t)] (const auto& arg) { return arg > val; };
}
template<typename Functor>
void g(Functor f)
{
for (int i = 0; i < 100000; i++)
f(i);
}
int main()
{
g(greater_than(10));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment