1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17
3 
foo(int * a,int * b)4 void foo(int* a, int *b) {
5   a -= b; // expected-error {{incompatible integer to pointer conversion assigning to 'int *' from}}
6 }
7 
8 template<typename T> T declval();
9 struct true_type { static const bool value = true; };
10 struct false_type { static const bool value = false; };
11 template<bool, typename T, typename U> struct select { using type = T; };
12 template<typename T, typename U> struct select<false, T, U> { using type = U; };
13 
14 
15 template<typename T>
16 typename select<(sizeof(declval<T>() -= declval<T>(), 1) != 1), true_type, false_type>::type test(...);
17 template<typename T> false_type test(...);
18 
19 template<typename T>
20 static const auto has_minus_assign = decltype(test<T>())::value;
21 
22 static_assert(has_minus_assign<int*>, "failed"); // expected-error {{static_assert failed due to requirement 'has_minus_assign<int *>' "failed"}}
23