1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include <cmath>
10
11 #include "test_macros.h"
12
main(int,char **)13 int main(int, char**)
14 {
15 unsigned int ui = -5;
16 ui = std::abs(ui); // expected-error {{call to 'abs' is ambiguous}}
17
18 unsigned char uc = -5;
19 uc = std::abs(uc); // expected-warning {{taking the absolute value of unsigned type 'unsigned char' has no effect}}
20
21 unsigned short us = -5;
22 us = std::abs(us); // expected-warning {{taking the absolute value of unsigned type 'unsigned short' has no effect}}
23
24 unsigned long ul = -5;
25 ul = std::abs(ul); // expected-error {{call to 'abs' is ambiguous}}
26
27 unsigned long long ull = -5;
28 ull = ::abs(ull); // expected-error {{call to 'abs' is ambiguous}}
29
30 return 0;
31 }
32