[libc-commits] [PATCH] D156629: [libc] Quiet initializer warnings in getopt

Roland McGrath via Phabricator via libc-commits libc-commits at lists.llvm.org
Sun Jul 30 15:11:35 PDT 2023


mcgrathr created this revision.
mcgrathr added reviewers: michaelrj, abrachet, Caslyn.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
mcgrathr requested review of this revision.

This prevents -Wmissing-braces warnings.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156629

Files:
  libc/src/unistd/getopt.cpp


Index: libc/src/unistd/getopt.cpp
===================================================================
--- libc/src/unistd/getopt.cpp
+++ libc/src/unistd/getopt.cpp
@@ -22,6 +22,9 @@
 namespace __llvm_libc {
 
 template <typename T> struct RefWrapper {
+  RefWrapper() = delete;
+  constexpr RefWrapper(T *p) : ptr{p} {}
+  constexpr RefWrapper(const RefWrapper &) = default;
   RefWrapper &operator=(const RefWrapper &) = default;
   operator T &() { return *ptr; }
   T &get() { return *ptr; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156629.545472.patch
Type: text/x-patch
Size: 495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230730/1583416e/attachment.bin>


More information about the libc-commits mailing list