Closed as not planned
Description
Bugzilla Link | 47640 |
Version | trunk |
OS | Linux |
CC | @dwblaikie,@gribozavr,@mgehre,@zygoloid,@Xazax-hun |
Extended Description
-Wdangling-gsl is a warning that catches dangling pointers. This warning catches a lot of lifetime bugs, but it only does so during initialization. Similar code that causes a dangling pointer during assignments does not get a warning.
#include
#include <string_view>
#include
std::string get_string();
std::unique_ptr get_int();
int main() {
std::string_view sv = get_string(); // Warning on initialization
sv = get_string(); // No warning on assignment
int *p = get_int().get(); // Warning on initialization
p = get_int().get(); // No warning on assignment
}