C++ Logo

std-discussion

Advanced search

Re: [[maybe_unused]] classes

From: Stephan Bergmann <sbergman_at_[hidden]>
Date: Thu, 20 Apr 2023 08:18:07 +0200
On 4/19/23 16:17, Andrew Tomazos wrote:
> It could be that it is a good idea that [[maybe_unused]] is "inherited"
> across this particular type-variable relationship. I did not consider
> this use case when designing it. If you think it is a good idea - then
> I encourage you to write a proposal to extend the semantics of the
> attribute in this fashion. If adopted, I'm sure the MSVC guys will
> implement it. If rejected for semantic reasons, I'm sure GCC/Clang will
> follow suit too.

Thanks for your clarifications. I had just been curious about this
apparent discrepancy in compiler behavior and standard wording. I don't
have a strong opinion either way, so I won't carry this further.
(Though I tend to think that something like
<https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2169r3.pdf>
"A nice placeholder with no name", making _ variables implicitly
maybe_unused, would nicely cover at least the guard variable scenario;
and in general it might be better to let maybe_unused consistently
affect only the marked entity.)

Received on 2023-04-20 06:18:13