-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Description
Consider this definition of std::make_unique:
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}Add implicit annotations to the template instantiations of make_unqiue where the constructed type has lifetimebound arguments.
struct A {
std::string_view view;
std::string owner;
A(const std::string& a [[clang::lifetimebound]], const std::string& b) : view(a), owner(b) {}
};std::make_unique<A> function template should have its first arg to a as lifetimebound but not the other other arg to b.
This can be done by looking at the corresponding constructor of the type being constructed. example
Metadata
Metadata
Assignees
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Type
Projects
Status
No status