Does attribute specifier sequence inherit?
问题 Look at this snippet: struct [[nodiscard]] Result { }; struct DiscardableResult: Result { }; Does DiscardableResult have the [[nodiscard]] attribute? If yes, is it possible to remove it somehow? 回答1: [dcl.attr.nodiscard]/2 says: A nodiscard call is a function call expression that calls a function previously declared nodiscard , or whose return type is a possibly cv-qualified class or enumeration type marked nodiscard . The return type of the function is DiscardableResult . This type is not