mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 03:32:35 +08:00
Add additional constraints on midpoint(pointer, pointer). Fixes PR#42037.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361970 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -18,13 +18,22 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int func1 () { return 1; }
|
||||
int func2 () { return 2; }
|
||||
|
||||
struct Incomplete;
|
||||
Incomplete *ip = nullptr;
|
||||
void *vp = nullptr;
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
(void) std::midpoint(false, true); // expected-error {{no matching function for call to 'midpoint'}}
|
||||
(void) std::midpoint(false, true); // expected-error {{no matching function for call to 'midpoint'}}
|
||||
|
||||
// A couple of odd pointer types that should fail
|
||||
(void) std::midpoint(nullptr, nullptr); // expected-error {{no matching function for call to 'midpoint'}}
|
||||
(void) std::midpoint((void *)0, (void *)0); // expected-error@numeric:* {{arithmetic on pointers to void}}
|
||||
(void) std::midpoint(nullptr, nullptr); // expected-error {{no matching function for call to 'midpoint'}}
|
||||
(void) std::midpoint(func1, func2); // expected-error {{no matching function for call to 'midpoint'}}
|
||||
(void) std::midpoint(ip, ip); // expected-error {{no matching function for call to 'midpoint'}}
|
||||
(void) std::midpoint(vp, vp); // expected-error {{no matching function for call to 'midpoint'}}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user