]> granicus.if.org Git - clang/commitdiff
PR20090: Add (passing) test from this bug; it's been fixed for a while.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 7 Jan 2017 00:52:10 +0000 (00:52 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 7 Jan 2017 00:52:10 +0000 (00:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291319 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaTemplate/constexpr-instantiate.cpp

index b8cfbe1e0e20144a731ad75dd3a07ee08f67ab05..dfb8a07d3b7ddddd6785108ec3a5d6ef11d9830c 100644 (file)
@@ -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, "");
+}