[llvm-bugs] [Bug 42037] New: C++2a std::midpoint's "Constraints" are not implemented
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 27 11:43:37 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42037
Bug ID: 42037
Summary: C++2a std::midpoint's "Constraints" are not
implemented
Product: libc++
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: arthur.j.odwyer at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
// https://godbolt.org/z/mAL4Sd
#include <numeric>
int a();
int b();
int main() {
std::midpoint(a, b);
}
====
/c++/v1/numeric:554:52: error: arithmetic on pointers to the function type 'int
()'
return __a + _VSTD::midpoint(ptrdiff_t(0), __b - __a);
~~~ ^ ~~~
According to N4810, std::midpoint for `T*` should be constrained to require `T`
to be a complete object type (not a function type, and not cv void either).
I'm fairly confident that no library code should ever try to constrain on
`is_pointer` without also asking whether it's an object pointer, function
pointer, member pointer, or void pointer. It might be worth auditing the entire
libc++ codebase for uses of `is_pointer`.
--
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/20190527/2e2ee1df/attachment-0001.html>
More information about the llvm-bugs
mailing list