19081d3d8SHaojian Wu // RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target aarch64-linux-gnu -I %clang_tidy_headers
289a1d03eSRichard 
39081d3d8SHaojian Wu #include "integral_constant.h"
489a1d03eSRichard 
float16_normal_literals()589a1d03eSRichard void float16_normal_literals() {
689a1d03eSRichard   // _Float16
789a1d03eSRichard 
889a1d03eSRichard   static constexpr auto v14 = 1.f16;
989a1d03eSRichard   // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
1089a1d03eSRichard   // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1.f16;
1189a1d03eSRichard   // CHECK-MESSAGES-NEXT: ^ ~
12*f63155aaSTimm Bäder   // CHECK-MESSAGES-NEXT: F16{{$}}
1389a1d03eSRichard   // CHECK-FIXES: static constexpr auto v14 = 1.F16;
1489a1d03eSRichard   static_assert(is_same<decltype(v14), const _Float16>::value, "");
1589a1d03eSRichard   static_assert(v14 == 1.F16, "");
1689a1d03eSRichard 
1789a1d03eSRichard   static constexpr auto v15 = 1.e0f16;
1889a1d03eSRichard   // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
1989a1d03eSRichard   // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1.e0f16;
2089a1d03eSRichard   // CHECK-MESSAGES-NEXT: ^ ~
21*f63155aaSTimm Bäder   // CHECK-MESSAGES-NEXT: F16{{$}}
2289a1d03eSRichard   // CHECK-FIXES: static constexpr auto v15 = 1.e0F16;
2389a1d03eSRichard   static_assert(is_same<decltype(v15), const _Float16>::value, "");
2489a1d03eSRichard   static_assert(v15 == 1.F16, "");
2589a1d03eSRichard 
2689a1d03eSRichard   static constexpr auto v16 = 1.F16; // OK.
2789a1d03eSRichard   static_assert(is_same<decltype(v16), const _Float16>::value, "");
2889a1d03eSRichard   static_assert(v16 == 1.F16, "");
2989a1d03eSRichard 
3089a1d03eSRichard   static constexpr auto v17 = 1.e0F16; // OK.
3189a1d03eSRichard   static_assert(is_same<decltype(v17), const _Float16>::value, "");
3289a1d03eSRichard   static_assert(v17 == 1.F16, "");
3389a1d03eSRichard }
3489a1d03eSRichard 
float16_hexadecimal_literals()3589a1d03eSRichard void float16_hexadecimal_literals() {
3689a1d03eSRichard // _Float16
3789a1d03eSRichard 
3889a1d03eSRichard   static constexpr auto v13 = 0xfp0f16;
3989a1d03eSRichard   // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
4089a1d03eSRichard   // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 0xfp0f16;
4189a1d03eSRichard   // CHECK-MESSAGES-NEXT: ^    ~
42*f63155aaSTimm Bäder   // CHECK-MESSAGES-NEXT: F16{{$}}
4389a1d03eSRichard   // CHECK-FIXES: static constexpr auto v13 = 0xfp0F16;
4489a1d03eSRichard   static_assert(is_same<decltype(v13), const _Float16>::value, "");
4589a1d03eSRichard   static_assert(v13 == 0xfp0F16, "");
4689a1d03eSRichard 
4789a1d03eSRichard   static constexpr auto v14 = 0xfp0F16; // OK.
4889a1d03eSRichard   static_assert(is_same<decltype(v14), const _Float16>::value, "");
4989a1d03eSRichard   static_assert(v14 == 0xfp0F16, "");
5089a1d03eSRichard 
5189a1d03eSRichard }
52