Skip to content

Commit 0e81c91

Browse files
committed
Add tests for #100549
1 parent 8d28136 commit 0e81c91

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

clang/test/Sema/warn-lifetime-analysis-nocfg.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,5 +508,20 @@ FooView test3(int i, std::optional<Foo> a) {
508508
return *a; // expected-warning {{address of stack memory}}
509509
return a.value(); // expected-warning {{address of stack memory}}
510510
}
511+
} // namespace GH93386
511512

513+
namespace GH100549 {
514+
struct UrlAnalyzed {
515+
UrlAnalyzed(std::string_view url [[clang::lifetimebound]]);
516+
};
517+
std::string StrCat(std::string_view, std::string_view);
518+
void test1() {
519+
UrlAnalyzed url(StrCat("abc", "bcd")); // expected-warning {{object backing the pointer will be destroyed}}
520+
}
521+
522+
std::string_view ReturnStringView(std::string_view abc [[clang::lifetimebound]]);
523+
524+
void test() {
525+
std::string_view svjkk1 = ReturnStringView(StrCat("bar", "x")); // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}}
512526
}
527+
} // namespace GH100549

0 commit comments

Comments
 (0)