1 // RUN: %check_clang_tidy -std=c++17-or-later %s modernize-unary-static-assert %t
2 
3 #define FOO static_assert(sizeof(a) <= 15, "");
4 #define MSG ""
5 
f_textless(int a)6 void f_textless(int a) {
7   static_assert(sizeof(a) <= 10, "");
8   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use unary 'static_assert' when the string literal is an empty string [modernize-unary-static-assert]
9   // CHECK-FIXES: {{^}}  static_assert(sizeof(a) <= 10 );{{$}}
10   static_assert(sizeof(a) <= 12, L"");
11   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use unary 'static_assert' when
12   // CHECK-FIXES: {{^}}  static_assert(sizeof(a) <= 12 );{{$}}
13   FOO
14   // CHECK-FIXES: {{^}}  FOO{{$}}
15   static_assert(sizeof(a) <= 17, MSG);
16   // CHECK-FIXES: {{^}}  static_assert(sizeof(a) <= 17, MSG);{{$}}
17 }
18 
f_with_tex(int a)19 void f_with_tex(int a) {
20   static_assert(sizeof(a) <= 10, "Size of variable a is out of range!");
21 }
22 
f_unary(int a)23 void f_unary(int a) { static_assert(sizeof(a) <= 10); }
24 
f_incorrect_assert()25 void f_incorrect_assert() { static_assert(""); }
26