diff --git a/src/coreclr/interop/comwrappers.cpp b/src/coreclr/interop/comwrappers.cpp index 095f098e286015..96f47a0f040602 100644 --- a/src/coreclr/interop/comwrappers.cpp +++ b/src/coreclr/interop/comwrappers.cpp @@ -736,7 +736,16 @@ HRESULT ManagedObjectWrapper::QueryInterface( return E_NOINTERFACE; default: - _ASSERTE(false && "Unknown result value"); + // NOTE: here the `result == *` of assert is just for avoiding the compiling error + // `fallthrough annotation in unreachable code` within debug mode using clang <=13. + // Because clang versions before 14 had a bug here. + _ASSERTE( +#if defined(__clang__) && (__clang_major__ < 14) + (result == TryInvokeICustomQueryInterfaceResult::FailedToInvoke) +#else + false +#endif + && "Unknown result value"); FALLTHROUGH; case TryInvokeICustomQueryInterfaceResult::FailedToInvoke: // Set the 'lacks' flag since our attempt to use ICustomQueryInterface diff --git a/src/coreclr/pal/inc/pal.h b/src/coreclr/pal/inc/pal.h index 9a1d25515bb32e..70b934a8ccd88e 100644 --- a/src/coreclr/pal/inc/pal.h +++ b/src/coreclr/pal/inc/pal.h @@ -184,14 +184,6 @@ extern bool g_arm64_atomics_present; #define __has_cpp_attribute(x) (0) #endif -#ifndef FALLTHROUGH -#if __has_cpp_attribute(fallthrough) -#define FALLTHROUGH [[fallthrough]] -#else // __has_cpp_attribute(fallthrough) -#define FALLTHROUGH -#endif // __has_cpp_attribute(fallthrough) -#endif // FALLTHROUGH - /******************* PAL-Specific Entrypoints *****************************/ #define IsDebuggerPresent PAL_IsDebuggerPresent