[llvm-bugs] [Bug 44846] New: std::to_address isn't SFINAE friendly

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 7 21:13:04 PST 2020


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

            Bug ID: 44846
           Summary: std::to_address isn't SFINAE friendly
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cjdb.ns at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

The following example should compile, but causes an instantiation error.

```
#include <memory>

struct dummy {};

struct iterator {
        using element_type = dummy;
        int* operator->() const;
};

template<typename I>
concept passing = requires(I const& i) {
    std::to_address(i);
};

static_assert(not passing<iterator>);
```

Because `std::to_address` has a deduced return type, the concept `passing` must
instantiate `std::to_address`, which means that it ironically causes a hard
error when trying to check if the expression is well-formed (the concept is not
at fault here). Changing `std::to_address` to be SFINAE-friendly will be
necessary to implement `std::contiguous_iterator`.

Related issue: https://bugs.llvm.org/show_bug.cgi?id=44674

-- 
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/20200208/82d33c9f/attachment-0001.html>


More information about the llvm-bugs mailing list