Skip to content

Commit bd6e64f

Browse files
committed
add test case about explicitly capturing variable
1 parent 83df149 commit bd6e64f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang/test/SemaCXX/uninitialized.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,10 +892,11 @@ namespace lambdas {
892892
return a1.x;
893893
});
894894
A a2([&] { return a2.x; }); // ok
895-
A a3([=]{ return a3.x; }()); // expected-warning{{variable 'a3' is uninitialized when used within its own initialization}}
896-
A a4([&]{ return a4.x; }()); // expected-warning{{variable 'a4' is uninitialized when used within its own initialization}}
897-
A a5([&]{ return a5; }()); // expected-warning{{variable 'a5' is uninitialized when used within its own initialization}}
898-
A a6([&]{ return a5.x; }()); // ok
895+
A a3([=] { return a3.x; }()); // expected-warning{{variable 'a3' is uninitialized when used within its own initialization}}
896+
A a4([&] { return a4.x; }()); // expected-warning{{variable 'a4' is uninitialized when used within its own initialization}}
897+
A a5([&] { return a5; }()); // expected-warning{{variable 'a5' is uninitialized when used within its own initialization}}
898+
A a6([&] { return a5.x; }()); // ok
899+
A a7 = [&a7] { return a7; }(); // expected-warning{{variable 'a7' is uninitialized when used within its own initialization}}
899900
}
900901
}
901902

0 commit comments

Comments
 (0)