[LLVMbugs] [Bug 20090] New: Instantiation depth hit in recursive constexpr function definition

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 20 13:07:35 PDT 2014


            Bug ID: 20090
           Summary: Instantiation depth hit in recursive constexpr
                    function definition
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Keywords: compile-fail
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ldionne.2 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12688
  --> http://llvm.org/bugs/attachment.cgi?id=12688&action=edit
Exact error message


The following code hits the recursive instantiation depth limit on Clang
template <typename T>
constexpr T fact(T n)
{ return n == 0 ? 1 : [=]{ return n * fact(n-1); }(); }

// template int fact(int);
int main() { fact(1); }

If you explicitly instantiate the function template (uncomment the line
above main), the problem goes away. The problem also goes away if fact
is not constexpr.

The exact command line is:
~/code/llvm/build/bin/clang++ -std=c++1y -o /dev/null

Louis Dionne

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140620/08bec9ce/attachment.html>

More information about the llvm-bugs mailing list