[libcxx-commits] [libcxx] [libc++] Adds a global private constructor tag. (PR #87920)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 9 09:47:19 PDT 2024


================
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP__UTILITY_PRIVATE_CONSTRUCTOR_TAG_H
+#define _LIBCPP__UTILITY_PRIVATE_CONSTRUCTOR_TAG_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// This struct is intended to use to make a non-standard constructor
+// exposition-only. This does not prevent users from using the constructor, but
+// they need to explicitly use __ugly_code and include a private header.
----------------
ldionne wrote:

```suggestion
// This tag allows defining non-standard exposition-only constructors while
// preventing users from being able to use them, since this reserved-name
// tag needs to be used.
```

Otherwise the comment was reading as an invitation for users to actually use this tag :)

https://github.com/llvm/llvm-project/pull/87920


More information about the libcxx-commits mailing list