Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions strings/base_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,33 @@ namespace winrt::impl
static constexpr auto data{ category_signature<category_t<T>, T>::data };
};

#if defined(__clang__)
template <typename T>
struct classic_com_guid
struct classic_com_guid_error
{
#if __has_declspec_attribute(uuid) && defined(WINRT_IMPL_IUNKNOWN_DEFINED)
static constexpr guid value{ __uuidof(T) };
#else
static_assert(std::is_void_v<T> /* dependent_false */, "To use classic COM interfaces, you must compile with -fms-extensions and include <unknwn.h> before including C++/WinRT headers.");
#ifdef __clang__
#if !__has_declspec_attribute(uuid)
static_assert(std::is_void_v<T> /* dependent_false */, "To use classic COM interfaces, you must compile with -fms-extensions.");
#endif

#ifndef WINRT_IMPL_IUNKNOWN_DEFINED
static_assert(std::is_void_v<T> /* dependent_false */, "To use classic COM interfaces, you must include <unknwn.h> before including C++/WinRT headers.");
#endif
#else // MSVC won't hit this struct, so we can safely assume everything that isn't Clang isn't supported
static_assert(std::is_void_v<T> /* dependent_false */, "Classic COM interfaces are not supported with this compiler.");
#endif
};

template <typename T>
inline constexpr guid guid_v = classic_com_guid<T>::value;
#ifdef __clang__
#if __has_declspec_attribute(uuid) && defined(WINRT_IMPL_IUNKNOWN_DEFINED)
inline constexpr guid guid_v{ __uuidof(T) };
#else
template <typename T>
inline constexpr guid guid_v = classic_com_guid_error<T>::value;
#endif
#elif defined(_MSC_VER)
inline constexpr guid guid_v{ __uuidof(T) };
#else
inline constexpr guid guid_v = classic_com_guid_error<T>::value;
#endif

template <typename T>
Expand Down