Add tests which include brace initialization
authorStephen Kelly <steveire@gmail.com>
Mon, 1 Mar 2021 00:33:03 +0000 (00:33 +0000)
committerStephen Kelly <steveire@gmail.com>
Mon, 1 Mar 2021 00:34:58 +0000 (00:34 +0000)
clang-tools-extra/test/clang-tidy/checkers/bugprone-unused-raii.cpp

index d637806..3428d45 100644 (file)
@@ -64,6 +64,13 @@ void test() {
 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: object destroyed immediately after creation; did you mean to name the object?
 // CHECK-FIXES: FooBar give_me_a_name;
 
+  Foo{42};
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: object destroyed immediately after creation; did you mean to name the object?
+  // CHECK-FIXES: Foo give_me_a_name{42};
+  FooBar{};
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: object destroyed immediately after creation; did you mean to name the object?
+  // CHECK-FIXES: FooBar give_me_a_name;
+
   templ<FooBar>();
   templ<Bar>();