colinfang
colinfang

Reputation: 21707

[[maybe_unused]] with structured_binding?

: warning: unused variable ‘_y’ [-Wunused-variable]
[[maybe_unused]] const auto [x, _y] = f();

How do I prevent the warning here? [[maybe_unused]] doesn't seem to work in this case?

Upvotes: 0

Views: 197

Answers (1)

colinfang
colinfang

Reputation: 21707

As suggested by comments, -Wunused-variable only appears in gcc7

[[maybe_unused]] is not needed for newer gcc

Upvotes: 1

Related Questions