Clang Project

clang_source_code/test/SemaCXX/ms-iunknown-template-function.cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
2// expected-no-diagnostics
3typedef long HRESULT;
4typedef unsigned long ULONG;
5typedef struct _GUID {
6  unsigned long Data1;
7  unsigned short Data2;
8  unsigned short Data3;
9  unsigned char Data4[8];
10} GUID;
11typedef GUID IID;
12
13// remove stdcall, since the warnings have nothing to do with
14// what is being tested.
15#define __stdcall
16
17extern "C" {
18extern "C++" {
19struct __declspec(uuid("00000000-0000-0000-C000-000000000046"))
20    IUnknown {
21public:
22  virtual HRESULT __stdcall QueryInterface(
23      const IID &riid,
24      void **ppvObject) = 0;
25
26  virtual ULONG __stdcall AddRef(void) = 0;
27
28  virtual ULONG __stdcall Release(void) = 0;
29
30  template <class Q>
31  HRESULT __stdcall QueryInterface(Q **pp) {
32    return QueryInterface(__uuidof(Q), (void **)pp);
33  }
34};
35}
36}
37
38__interface ISfFileIOPropertyPage : public IUnknown{};
39
40