# define _LIBCPP_DIAGNOSE_ERROR(...)
#endif
+#if __has_attribute(fallthough) || defined(_LIBCPP_COMPILER_GCC)
+// Use a function like macro to imply that it must be followed by a semicolon
+#define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
+#else
+#define _LIBCPP_FALLTHROUGH() ((void)0)
+#endif
+
#if defined(_LIBCPP_ABI_MICROSOFT) && \
(defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
make(A0 a0)
{
static typename aligned_storage<sizeof(T)>::type buf;
- ::new (&buf) T(a0);
- return *reinterpret_cast<T*>(&buf);
+ auto *obj = ::new (&buf) T(a0);
+ return *obj;
}
template <class T, class A0, class A1>
make(A0 a0, A1 a1, A2 a2)
{
static typename aligned_storage<sizeof(T)>::type buf;
- ::new (&buf) T(a0, a1, a2);
- return *reinterpret_cast<T*>(&buf);
+ auto *obj = ::new (&buf) T(a0, a1, a2);
+ return *obj;
}
template <typename T, size_t N>
{
// only one thread can get in here and it only gets in once
static aligned_storage<sizeof(locale)>::type buf;
- ::new (&buf) locale(locale::classic());
- return *reinterpret_cast<locale*>(&buf);
+ auto *obj = ::new (&buf) locale(locale::classic());
+ return *obj;
}
locale&