[llvm-bugs] [Bug 24518] New: ICE when constructing tuple

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 20 01:47:25 PDT 2015


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

            Bug ID: 24518
           Summary: ICE when constructing tuple
           Product: clang
           Version: 3.7
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: _ at adityaramesh.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

I tried compiling some code involving `std::tuple` using clang 3.7 (trunk
241984, downloaded via Macports) and clang 3.6.1 (also downloaded via
Macports). Compiling under clang-3.7 results in an ICE. On the other hand,
clang-3.6.1 produces a spurious error message. I've attached the preprocessed
source file and run script resulting from the ICE.

I've looked into the spurious error message given by clang-3.6, but I have not
been able to produce a MWE. In short, here's what's happening. I'm writing a
multidimensional array library, and have a class like this:

    template <class Func, class... Ts>
    struct elemwise_expr final
    {
        std::tuple<const Ts&...> m_refs;
    const Func& m_func;
public:
    CC_ALWAYS_INLINE
    explicit elemwise_expr(const Func& f, const Ts&... ts)
    noexcept : m_refs{ts...}, m_func{f} {}

        // Code omitted.
    };

When I compile this code under clang-3.6.1, the compiler generates several "no
matching constructor for initialization of ..." errors involving types from my
library. After looking over my own code carefully, I realized that the error
was generated by the `__is_constructible` test for the `tuple(_Up&&... __u)`
constructor. It turns out that for some reason, this constructor appears to
have been supplied only one argument -- a tuple -- despite the fact that none
of the types `ts...` in my own code are tuples. Somehow, the arguments used to
initialize `m_refs` are being redundantly nested in a tuple. The
`__is_constructible` test then tries to invoke the constructors of various
types in my library with a single tuple as an argument, and this fails. My
guess is that this strange error becomes an ICE under clang 3.7.

Do you have any recommendations for workarounds, or how I could produce an MWE?
I believe you should be able to compile the preprocessed source file under
clang-3.6.1 instead of clang-3.7 to get the same results.

-- 
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/20150820/9bfc3949/attachment.html>


More information about the llvm-bugs mailing list