From 1e7cc03abb930d09d3b4cee4d709978fe28a0d28 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sat, 7 Jan 2017 00:52:10 +0000 Subject: [PATCH] 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 --- test/SemaTemplate/constexpr-instantiate.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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 constexpr T fact(T n) { + return n == 0 ? 1 : [=] { return n * fact(n - 1); }(); + } + static_assert(fact(0) == 1, ""); +} -- 2.40.0