I think it's not really a duplicate of Are function attributes inherited?, because i'm wondering about classes, not member functions :
struct [[nodiscard]] error {};
struct critical_error : error {};
critical_error_code foo();
int main() {
foo(); // no warning.
}
It seems that the [[nodiscard]] attribute is not inherited here. Is it the same for all type-attributes ?
Thank you
Aucun commentaire:
Enregistrer un commentaire