Skip to content

Commit 36235ce

Browse files
committed
Add a testcase for the -Wdangling-assignment-gsl warning, NFC.
1 parent d50d961 commit 36235ce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ struct [[gsl::Pointer]] Span {
713713
// Pointer from Owner<Pointer>
714714
std::string_view test5() {
715715
std::string_view a = StatusOr<std::string_view>().valueLB(); // expected-warning {{object backing the pointer will be dest}}
716-
return StatusOr<std::string_view>().valueLB(); // expected-warning {{returning address of local temporary}}
716+
return StatusOr<std::string_view>().valueLB(); // expected-warning {{returning address of local temporary}}
717717

718718
// No dangling diagnostics on non-lifetimebound methods.
719719
std::string_view b = StatusOr<std::string_view>().valueNoLB();
@@ -724,6 +724,7 @@ return StatusOr<std::string_view>().valueLB(); // expected-warning {{returning a
724724
// Prevent regression GH108463
725725
Span<int*> test6(std::vector<int*> v) {
726726
Span<int *> dangling = std::vector<int*>(); // expected-warning {{object backing the pointer}}
727+
dangling = std::vector<int*>(); // expected-warning {{object backing the pointer}}
727728
return v; // expected-warning {{address of stack memory}}
728729
}
729730

0 commit comments

Comments
 (0)