xref: /llvm-project/clang/test/SemaCXX/ms-iunknown-template-function.cpp (revision fcdf09e04be8186727e042a7cb8fb9746ef3db95)
1*fcdf09e0SErich Keane // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
2*fcdf09e0SErich Keane // expected-no-diagnostics
33e08f66bSErich Keane typedef long HRESULT;
43e08f66bSErich Keane typedef unsigned long ULONG;
53e08f66bSErich Keane typedef struct _GUID {
63e08f66bSErich Keane   unsigned long Data1;
73e08f66bSErich Keane   unsigned short Data2;
83e08f66bSErich Keane   unsigned short Data3;
93e08f66bSErich Keane   unsigned char Data4[8];
103e08f66bSErich Keane } GUID;
113e08f66bSErich Keane typedef GUID IID;
123e08f66bSErich Keane 
133e08f66bSErich Keane // remove stdcall, since the warnings have nothing to do with
143e08f66bSErich Keane // what is being tested.
153e08f66bSErich Keane #define __stdcall
163e08f66bSErich Keane 
173e08f66bSErich Keane extern "C" {
183e08f66bSErich Keane extern "C++" {
19*fcdf09e0SErich Keane struct __declspec(uuid("00000000-0000-0000-C000-000000000046"))
203e08f66bSErich Keane     IUnknown {
213e08f66bSErich Keane public:
223e08f66bSErich Keane   virtual HRESULT __stdcall QueryInterface(
233e08f66bSErich Keane       const IID &riid,
243e08f66bSErich Keane       void **ppvObject) = 0;
253e08f66bSErich Keane 
263e08f66bSErich Keane   virtual ULONG __stdcall AddRef(void) = 0;
273e08f66bSErich Keane 
283e08f66bSErich Keane   virtual ULONG __stdcall Release(void) = 0;
293e08f66bSErich Keane 
303e08f66bSErich Keane   template <class Q>
QueryInterfaceIUnknown313e08f66bSErich Keane   HRESULT __stdcall QueryInterface(Q **pp) {
323e08f66bSErich Keane     return QueryInterface(__uuidof(Q), (void **)pp);
333e08f66bSErich Keane   }
343e08f66bSErich Keane };
353e08f66bSErich Keane }
363e08f66bSErich Keane }
373e08f66bSErich Keane 
383e08f66bSErich Keane __interface ISfFileIOPropertyPage : public IUnknown{};
393e08f66bSErich Keane 
40