-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang: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
struct S {
const int& x() const [[clang::lifetimebound]];
static const int& y(const S &self [[clang::lifetimebound]]);
int i;
};
#if DO_INLINE
inline const int& S::x() const { return i; }
inline const int& S::y(const S &self) { return self.i; }
#endif
void G() {
auto& x = S().x();
auto& y = S::y(S());
}Clang warns that x and y are dangling with -UDO_INLINE but the warnings are silenced under -DDO_INLINE. It looks like these attributes are not being propagated from the declaration to the definition properly (presumably because they are type attributes rather than declaration attributes, and they don't change the canonical type).
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang: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