<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Instantiation depth hit in recursive constexpr function definition"
   href="http://llvm.org/bugs/show_bug.cgi?id=20090">20090</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Instantiation depth hit in recursive constexpr function definition
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Keywords</th>
          <td>compile-fail
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ldionne.2@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12688" name="attach_12688" title="Exact error message">attachment 12688</a> <a href="attachment.cgi?id=12688&action=edit" title="Exact error message">[details]</a></span>
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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>