[LLVMbugs] [Bug 24173] New: Interminable compilation when using __is_constructible intrinsic

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 17 16:40:53 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24173

            Bug ID: 24173
           Summary: Interminable compilation when using __is_constructible
                    intrinsic
           Product: clang
           Version: 3.6
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          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

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?

-- 
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/20150717/e7dc1533/attachment.html>


More information about the llvm-bugs mailing list