Skip to content

Commit 2d6bb71

Browse files
committed
test
1 parent 2bd83d0 commit 2d6bb71

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/owning-memory.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,17 @@ namespace PR59389 {
475475
};
476476
}
477477

478+
void testLambdaInLambdaWithDoubleReturns() {
479+
const auto MakeS = []() -> S* {
480+
const auto MakeS2 = []() -> S* {
481+
return ::gsl::owner<S*>{new S(1)};
482+
// CHECK-NOTES: [[@LINE-1]]:9: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a lambda whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
483+
};
484+
return ::gsl::owner<S*>{new S(2)};
485+
// CHECK-NOTES: [[@LINE-1]]:7: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a lambda whose return type is not 'gsl::owner<>'
486+
};
487+
}
488+
478489
void testReverseLambdaInLambdaNegative() {
479490
const auto MakeI = []() -> int {
480491
const auto MakeS = []() -> ::gsl::owner<S*> { return new S(); };

0 commit comments

Comments
 (0)