aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C
new file mode 100644
index 0000000..e3e13f7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C
@@ -0,0 +1,6 @@
+// Test that we catch excessive recursion.
+// { dg-do compile { target c++11 } }
+// { dg-options "-fconstexpr-depth=5" }
+// { dg-prune-output "in constexpr expansion" }
+constexpr int f (int i) { return f (i-1); }
+constexpr int i = f(42); // { dg-error "constexpr evaluation depth" }