After #197753, we now warn when lifetimebound is written on the wrong declaration. This diagnostic would ideally have a fix-it that adds the attribute to the declaration that should carry it.
Currently we only warn that the user should add a lifetimebound attribute:
int* get(int &x); // warning: 'lifetimebound' attribute on this definition is not visible to callers before the definition; add it to the declaration instead
int* get(int &x [[clang::lifetimebound]]) {
return &x;
}
It would be more user-friendly if we could also create a suggestion with a lifetimebound attribute:
int* get(int &x); // fix-it: add [[clang::lifetimebound]] here
int* get(int &x [[clang::lifetimebound]]) {
return &x;
}
After applying the fix-it:
int* get(int &x [[clang::lifetimebound]]);
int* get(int &x [[clang::lifetimebound]]) {
return &x;
}
After #197753, we now warn when
lifetimeboundis written on the wrong declaration. This diagnostic would ideally have a fix-it that adds the attribute to the declaration that should carry it.Currently we only warn that the user should add a
lifetimeboundattribute:It would be more user-friendly if we could also create a suggestion with a
lifetimeboundattribute:After applying the fix-it: