summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-01-07 00:52:10 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-01-07 00:52:10 +0000
commit1e7cc03abb930d09d3b4cee4d709978fe28a0d28 (patch)
treef3aa1e6fbe68d6cf9f37e58e9c9ad04dd9582414 /test/SemaTemplate
parent8ea4b56436cd21f29fc7c5725903e8ab7c8c9e10 (diff)
PR20090: Add (passing) test from this bug; it's been fixed for a while.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r--test/SemaTemplate/constexpr-instantiate.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/SemaTemplate/constexpr-instantiate.cpp b/test/SemaTemplate/constexpr-instantiate.cpp
index b8cfbe1e0e..dfb8a07d3b 100644
--- a/test/SemaTemplate/constexpr-instantiate.cpp
+++ b/test/SemaTemplate/constexpr-instantiate.cpp
@@ -252,3 +252,10 @@ namespace NoInstantiationWhenSelectingOverload {
void h() { (void)sizeof(char{f(0)}); }
void i() { (void)sizeof(char{f("oops")}); } // expected-note {{instantiation of}}
}
+
+namespace PR20090 {
+ template <typename T> constexpr T fact(T n) {
+ return n == 0 ? 1 : [=] { return n * fact(n - 1); }();
+ }
+ static_assert(fact(0) == 1, "");
+}