summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/test/SemaTemplate/constexpr-instantiate.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/constexpr-instantiate.cpp b/clang/test/SemaTemplate/constexpr-instantiate.cpp
index b8cfbe1e0e2..dfb8a07d3b7 100644
--- a/clang/test/SemaTemplate/constexpr-instantiate.cpp
+++ b/clang/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, "");
+}
OpenPOWER on IntegriCloud