summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C
new file mode 100644
index 000000000..2f9b4887d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C
@@ -0,0 +1,5 @@
+// Test that we catch excessive recursion.
+// { dg-options "-std=c++0x -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" }