http://llvm.org/bugs/show_bug.cgi?id=20090

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

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

Hi,

The following code hits the recursive instantiation depth limit on Clang
r211266:
------------------------------------------------------------------------------
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
~/desktop/bugreport/worksheet.cpp


Regards,
Louis Dionne

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to