[llvm-bugs] [Bug 43066] New: Clang fails to compile code that uses std::apply on a member variable from a __restrict member function

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 20 13:09:17 PDT 2019


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

            Bug ID: 43066
           Summary: Clang fails to compile code that uses std::apply on a
                    member variable from a __restrict member function
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mike.k at digitalcarbide.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The following code fails to compile under Clang with '-std=c++2a' and
'-std=c++17':

#include <tuple>

struct foo {
    const std::tuple<int> v_;
    constexpr foo (int v) : v_(v) {}

    bool operator == (int value) const __restrict {
        return std::apply([](auto) {return true;}, v_);
    }
};

bool test (int v) {
    return foo{0} == v;
}

If the '__restrict' is removed from the 'operator ==', it compiles.

This code successfully compiles under GCC and MSVC:

https://godbolt.org/z/S8bGiA

The core errors appear to be:

tuple:1271:44: error: implicit instantiation of undefined template
'std::tuple_size<__restrict std::tuple<int> >'
    inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value;

tuple:1686:44: error: non-type template argument is not a constant expression
      using _Indices = make_index_sequence<tuple_size_v<decay_t<_Tuple>>>;

tuple:1687:14: error: no matching function for call to '__apply_impl'
      return std::__apply_impl(std::forward<_Fn>(__f),

-- 
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/20190820/6264dbdd/attachment.html>


More information about the llvm-bugs mailing list