Created on 2017-10-19.00:00:00 last changed 47 months ago
Proposed resolution (November, 2018):
Change 9.12.9 [dcl.attr.unused] paragraphs 2 and 3 as follows:
The attribute may be applied to the declaration of a class, a typedef-name, a variable (including a structured binding declaration), a non-static data member, a function, an enumeration, or an enumerator.
[Note:For an entity marked maybe_unused, implementations should not emit a warning that the entityisor its structured bindings (if any) are used or unused., or that the entity is used despite the presence of the attribute. —end note]For a structured binding declaration not marked maybe_unused, implementations should not emit such a warning unless all of its structured bindings are unused.
Notes from the October, 2018 teleconference:
CWG agreed that such an annotation should be permitted and apply to the underlying variable; i.e., a compiler might warn in the absence of such an attribute if none of the structured bindings were used, and the presence of the attribute would silence such warnings.
[Accepted as a DR at the February, 2019 meeting.]
According to9.12.9 [dcl.attr.unused] paragraph 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.
This does not include structured bindings, although there seems to be no good reason to prohibit uses like
[[maybe_unused]] auto [a, b] = std::make_pair(42, 0.23);
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-12-15 00:00:00 | admin | set | messages: + msg6403 |
2020-12-15 00:00:00 | admin | set | messages: + msg6402 |
2020-12-15 00:00:00 | admin | set | status: open -> cd5 |
2017-10-19 00:00:00 | admin | create |