From 0b9ae9e0e5e48ce5627169b6eb6227dadb0027fb Mon Sep 17 00:00:00 2001 From: Raymond Chen Date: Wed, 7 Sep 2022 11:23:46 -0700 Subject: [PATCH] Don't use __uuidof without GUID If GUID is not defined, then don't breathe the name of the `__uuidof` intrinsic, because that would instantiate an undefined structure. clang is stricter about this than msvc, but fix both just in case. --- strings/base_meta.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strings/base_meta.h b/strings/base_meta.h index f951c4db0..e80afb9bf 100644 --- a/strings/base_meta.h +++ b/strings/base_meta.h @@ -119,12 +119,12 @@ namespace winrt::impl template #if defined(__clang__) -#if __has_declspec_attribute(uuid) +#if __has_declspec_attribute(uuid) && defined(WINRT_IMPL_IUNKNOWN_DEFINED) inline const guid guid_v{ __uuidof(T) }; #else inline constexpr guid guid_v{}; #endif -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && defined(WINRT_IMPL_IUNKNOWN_DEFINED) inline constexpr guid guid_v{ __uuidof(T) }; #else inline constexpr guid guid_v{};