// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17

void foo(int* a, int *b) {
  a -= b; // expected-warning {{incompatible integer to pointer conversion assigning to 'int *' from}}
}

template<typename T> T declval();
struct true_type { static const bool value = true; };
struct false_type { static const bool value = false; };
template<bool, typename T, typename U> struct select { using type = T; };
template<typename T, typename U> struct select<false, T, U> { using type = U; };


template<typename T>
typename select<(sizeof(declval<T>() -= declval<T>(), 1) != 1), true_type, false_type>::type test(...);
template<typename T> false_type test(...);

template<typename T>
static const auto has_minus_assign = decltype(test<T>())::value;

static_assert(has_minus_assign<int*>, "failed"); // expected-error {{static_assert failed due to requirement 'has_minus_assign<int *>' "failed"}}

// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17

void foo(int* a, int *b) {
  a -= b; // expected-warning {{incompatible integer to pointer conversion assigning to 'int *' from 'long'}}
}

template<typename T> T declval();
struct true_type { static const bool value = true; };
struct false_type { static const bool value = false; };
template<bool, typename T, typename U> struct select { using type = T; };
template<typename T, typename U> struct select<false, T, U> { using type = U; };


template<typename T>
typename select<(sizeof(declval<T>() -= declval<T>(), 1) != 1), true_type, false_type>::type test(...);
template<typename T> false_type test(...);

template<typename T>
static const auto has_minus_assign = decltype(test<T>())::value;

static_assert(has_minus_assign<int*>, "failed"); // expected-error {{static_assert failed due to requirement 'has_minus_assign<int *>' "failed"}}

--- 
+++ 
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17
 
 void foo(int* a, int *b) {
-  a -= b; // expected-warning {{incompatible integer to pointer conversion assigning to 'int *' from 'long'}}
+  a -= b; // expected-warning {{incompatible integer to pointer conversion assigning to 'int *' from}}
 }
 
 template<typename T> T declval();
Fix test failure from r351495

The test has problems due to some platforms having a different type for
ptrdiff_t, so the error message is different.  The error message doesn't
matter to the test for anything other than an incompatible intger to
pointer conversion, so this patch removes the integral type from the
expected message.

Change-Id: I80e786f9b80268163813774bbf25a9ca25b6c60c

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@351550 91177308-0d34-0410-b5e6-96231b3b80d8
