vendredi 30 mars 2018

[[maybe_unused]] applied to static data members

The draft standard states about [[maybe_unused]] in 10.6.6 item 2

"The attribute may be applied to the declaration of a class, a typedef-name, a variable, a non-static data member, a function, an enumeration, or an enumerator."

Is there any reason to exclude static data members from this? i.e.

struct Foo {
    [[maybe_unused]] static inline int foo = 0;
};

I ask as I have a static data member whose type has a non trivial constructor that does useful stuff but is otherwise unused.

Aucun commentaire:

Enregistrer un commentaire