]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/g++.dg/cpp0x/constexpr-52892-1.C
PR c++/92590 - wrong handling of inherited default ctor.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-52892-1.C
CommitLineData
d7afa673
PC
1// PR c++/52892
2// { dg-do compile { target c++11 } }
3
4constexpr __SIZE_TYPE__ fibonacci(__SIZE_TYPE__ val) {
5 return (val <= 2) ? 1 : fibonacci(val - 1) + fibonacci(val - 2);
6}
7
8template <typename Function>
9struct Defer {
10 constexpr Defer(const Function func_) : func(func_) { }
11
12 const Function func;
13
14 template <typename... Args>
15 constexpr auto operator () (const Args&... args) -> decltype(func(args...)) {
16 return func(args...);
17 }
18};
19
20template <typename Function>
21constexpr Defer<Function> make_deferred(const Function f) {
22 return Defer<Function>(f);
23}
24
25int main() {
26 constexpr auto deferred = make_deferred(&fibonacci);
d0ff1cb4 27 static_assert(deferred(25) == 75025, "Static fibonacci call failed"); // { dg-error "no match for call" "" { target c++14 } }
d7afa673 28}
This page took 3.692246 seconds and 5 git commands to generate.