blob: d58cf0d563d183e2ec826645aed4e849770d6c51 [file] [log] [blame]
Zoe Carver6585f012019-08-20 15:43:25 +00001//===----------------------------------------------------------------------===//
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
13int 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;
Louis Dionnea5fa5f72020-03-17 12:27:10 -040019 uc = std::abs(uc); // expected-warning {{taking the absolute value of unsigned type 'unsigned char' has no effect}}
Zoe Carver6585f012019-08-20 15:43:25 +000020
21 unsigned short us = -5;
Louis Dionnea5fa5f72020-03-17 12:27:10 -040022 us = std::abs(us); // expected-warning {{taking the absolute value of unsigned type 'unsigned short' has no effect}}
Zoe Carver6585f012019-08-20 15:43:25 +000023
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}