Clang doesn't support the __constinit extension that we use pre-C++20,
but it does have its own equivalent attribute that can be used instead.
This makes it a little easier to use Clang to build libstdc++ (which
isn't supported. but is sometimes attempted for esoteric targets).
libstdc++-v3/ChangeLog:
* src/c++11/cxx11-ios_failure.cc (__constinit): Define as
equivalent attribute for Clang.
* src/c++11/future.cc (__constinit): Likewise.
* src/c++11/system_error.cc (__constinit): Likewise.
* src/c++17/memory_resource.cc (__constinit): Likewise.
# error This file should not be compiled for this configuration.
#endif
+#if __has_cpp_attribute(clang::require_constant_initialization)
+# define __constinit [[clang::require_constant_initialization]]
+#endif
+
namespace
{
struct io_error_category final : std::error_category
#include <future>
#include <bits/functexcept.h>
+#if __has_cpp_attribute(clang::require_constant_initialization)
+# define __constinit [[clang::require_constant_initialization]]
+#endif
+
namespace
{
struct future_error_category final : public std::error_category
#include <windows.h>
#endif
+#if __has_cpp_attribute(clang::require_constant_initialization)
+# define __constinit [[clang::require_constant_initialization]]
+#endif
+
namespace
{
using std::string;
# include <bits/move.h> // std::__exchange
#endif
+#if __has_cpp_attribute(clang::require_constant_initialization)
+# define __constinit [[clang::require_constant_initialization]]
+#endif
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION