diff --git a/strings/base_meta.h b/strings/base_meta.h index f19e0513a..0e800c49f 100644 --- a/strings/base_meta.h +++ b/strings/base_meta.h @@ -117,22 +117,33 @@ namespace winrt::impl static constexpr auto data{ category_signature, T>::data }; }; -#if defined(__clang__) template - 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 /* dependent_false */, "To use classic COM interfaces, you must compile with -fms-extensions and include before including C++/WinRT headers."); +#ifdef __clang__ +#if !__has_declspec_attribute(uuid) + static_assert(std::is_void_v /* 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 /* dependent_false */, "To use classic COM interfaces, you must include 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 /* dependent_false */, "Classic COM interfaces are not supported with this compiler."); #endif }; template - inline constexpr guid guid_v = classic_com_guid::value; +#ifdef __clang__ +#if __has_declspec_attribute(uuid) && defined(WINRT_IMPL_IUNKNOWN_DEFINED) + inline constexpr guid guid_v{ __uuidof(T) }; #else - template + inline constexpr guid guid_v = classic_com_guid_error::value; +#endif +#elif defined(_MSC_VER) inline constexpr guid guid_v{ __uuidof(T) }; +#else + inline constexpr guid guid_v = classic_com_guid_error::value; #endif template