* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-52892-1.C
blob91e1ea72c2de3df92ca113219bf25b484208c33b
1 // PR c++/52892
2 // { dg-do compile { target c++11 } }
4 constexpr __SIZE_TYPE__ fibonacci(__SIZE_TYPE__ val) {
5   return (val <= 2) ? 1 : fibonacci(val - 1) + fibonacci(val - 2);
8 template <typename Function>
9 struct Defer {
10   constexpr Defer(const Function func_) : func(func_) { }
12   const Function func;
14   template <typename... Args>
15   constexpr auto operator () (const Args&... args) -> decltype(func(args...)) {
16     return func(args...);
17   }
20 template <typename Function>
21 constexpr Defer<Function> make_deferred(const Function f) {
22   return Defer<Function>(f);
25 int main() {
26   constexpr auto deferred = make_deferred(&fibonacci);
27   static_assert(deferred(25) == 75025, "Static fibonacci call failed"); // { dg-error "no match for call" "" { target c++14 } }