1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17
4 void foo(int* a
, int *b
) {
5 a
-= b
; // expected-error {{incompatible integer to pointer conversion assigning to 'int *' from}}
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
; };
16 typename select
<(sizeof(declval
<T
>() -= declval
<T
>(), 1) != 1), true_type
, false_type
>::type
test(...);
17 template<typename T
> false_type
test(...);
20 static const auto has_minus_assign
= decltype(test
<T
>())::value
;
22 static_assert(has_minus_assign
<int*>, "failed"); // expected-error {{static assertion failed due to requirement 'has_minus_assign<int *>': failed}}