<html>
    <head>
      <base href="https://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 --- - Interminable compilation when using __is_constructible intrinsic" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24173&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=8xn9oYaxUvRbGQwWjFE9LzPqFksgSmwADW0pioL11LQ&s=MU0quHjycIxAQsjplESoydub0SLe4sHGI-N4fXC7gz0&e=">24173</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Interminable compilation when using __is_constructible intrinsic
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.6
          </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>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>The following code causes Clang to never finish compiling, eventually 
exhausting all the memory available on my machine:

------------------------------------------------------------------------------
#include <type_traits>


#if 1
#   define IS_CONSTRUCTIBLE(...) __is_constructible(__VA_ARGS__)
#else
#   define IS_CONSTRUCTIBLE(...) is_constructible<__VA_ARGS__>::value
#endif

template <typename ...T>
struct is_constructible
    : std::integral_constant<bool, __is_constructible(T...)>
{ };

template <bool ...b>
struct fast_and
    : std::is_same<fast_and<b...>, fast_and<(b, true)...>>
{ };

template <typename ...Xn>
struct closure {
    template <typename ...Yn, typename = typename std::enable_if<
        fast_and<IS_CONSTRUCTIBLE(Xn, Yn&&)...>::value
    >::type>
    explicit constexpr closure(Yn&& ...yn);

    template <typename ...Yn, typename = typename std::enable_if<
        fast_and<IS_CONSTRUCTIBLE(Xn, Yn&&)...>::value
    >::type>
    constexpr closure(closure<Yn...>&& other);
};

template <typename ...Xs>
constexpr
closure<std::decay_t<Xs>...> f(Xs&& ...xs)
{ return closure<std::decay_t<Xs>...>{static_cast<Xs&&>(xs)...}; }

int main() {
    f(f(f(f(f(f(f(f(f(f(f(f(1))))))))))));
}
------------------------------------------------------------------------------

Note that using the second definition for IS_CONSTRUCTIBLE fixes the problem.
Any clue what is happening?</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>