Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++2a std::midpoint's "Constraints" are not implemented #41382

Closed
Quuxplusone opened this issue May 27, 2019 · 2 comments
Closed

C++2a std::midpoint's "Constraints" are not implemented #41382

Quuxplusone opened this issue May 27, 2019 · 2 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@Quuxplusone
Copy link
Contributor

Bugzilla Link 42037
Resolution FIXED
Resolved on May 29, 2019 08:37
Version unspecified
OS All
CC @mclow

Extended Description

// https://godbolt.org/z/mAL4Sd
#include
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.

@Quuxplusone
Copy link
Contributor Author

assigned to @mclow

@mclow
Copy link
Contributor

mclow commented May 29, 2019

Fixed in revision 361970.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

2 participants