Commit 72727cba by Paolo Carlini Committed by Paolo Carlini

re PR c++/51878 (ICE or OOM with decltype + variadic templates + "indirect" function call)

2012-10-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51878
	* g++.dg/cpp0x/decltype45.C: New.

From-SVN: r192381
parent a13ab2bc
2012-10-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51878
* g++.dg/cpp0x/decltype45.C: New.
2012-10-11 Janus Weil <janus@gcc.gnu.org>
PR fortran/54784
......
// PR c++/51878
// { dg-do compile { target c++11 } }
template<class F, class... T>
auto indirect_call(F f, T... t) -> decltype(f(t...))
{
return f(t...);
}
template<class F, class T>
struct VariadicBind
{
F f;
T t;
template<class... A>
auto operator()(A... a) -> decltype(indirect_call(f, t, a...))
{
return indirect_call(f, t, a...);
}
};
template<class F>
void apply(F f)
{
f();
}
template<class F, class V1, class... V>
void apply(F f, V1 v1, V... v)
{
apply(VariadicBind<F, int>{f, v1}, v...);
}
void func(int, int) { }
int main()
{
apply(func, 0, 0);
}
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