// C:\Qt\Tools\QtCreator\bin\clang\bin\clang-tidy.exe clang-tidy-ice.cpp -- -fms-extensions // normally from via typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[ 8 ]; } GUID; struct __declspec(uuid("00000000-0000-0000-c000-000000000046")) IUnknown; const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}}; using REFGUID =const GUID &; bool IsEqualGUID(REFGUID rguid1, REFGUID rguid2); template void template_uuid() { #if 0 //ATL/comsuppp tend to be either comparing the GUID if(IsEqualGUID(*_IID,IID_IUnknown)) { } #elif 0 // or copying it for runtime use after type-erasure GUID iid = *_IID; #else // but neither seems to be necessary. While this produces "warning: expression result unused" (as expected) // for IID_IUnknown, mentioning the parameter in any way even unused and not dereferenced, // seems to be enough to provoke the crash when using __uuidof _IID; #endif } void foo() { #if 1 template_uuid<&_uuidof(IUnknown)>(); #else template_uuid<&IID_IUnknown>(); #endif }