Is default member init of bit-fields officially supported/encouraged?

99 views
Skip to first unread message

Xianzhu Wang

unread,
Oct 12, 2022, 3:47:11 PM10/12/22
to cxx
Hi,

Tricium suggested default member init for some bit-fields. It's great if this feature is officially supported, but I don't see it in this doc. Can we use this feature now, or is it just a bug of clang-tidy?

Thanks,
Xianzhu

David Benjamin

unread,
Oct 12, 2022, 3:49:10 PM10/12/22
to Xianzhu Wang, cxx
That might be a bug? I thought that only worked in C++20. Or did Clang backport it to older versions?

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/1e97ac67-0023-47b1-bf99-5790cba87f35n%40chromium.org.

Avi Drissman

unread,
Oct 12, 2022, 3:51:59 PM10/12/22
to David Benjamin, Xianzhu Wang, cxx
Default member init for bitfields does only work in C++20. I think it got rolled into ClangTidy/modernize-use-default-member-init without concern for availability.

Xianzhu Wang

unread,
Oct 12, 2022, 4:24:30 PM10/12/22
to cxx, a...@google.com, Xianzhu Wang, cxx, David Benjamin
Reply all
Reply to author
Forward
0 new messages