Skip to content

[dcl.attr.deprecated] Deprecating structured binding declarations #530

Closed
@cor3ntin

Description

@cor3ntin

[dcl.attr.deprecated]

Issue description:

The following code seem somewhat sensible, and there does not seem to be a a good reason for it to be disallowed

namespace binding {
  struct S { int i; }
  auto [G [[deprecated]]] = S{42};
  int test() {
    return G; // warn
  }
}

Suggested resolution:

The proposed warning mirror that of [[maybe_unused]]

Edit [dcl.attr.deprecated]/p2

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, a namespace, an enumeration, an enumerator, a concept, or a template specialization.

PS: The wording seemingly allows deprecating local variables, which seems of questionable usefulness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions