blob: df761d56a80013db06b2cf134918949a9fde7da9 [file] [log] [blame]
Erich Keane58bd6032017-09-15 16:03:35 +00001// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
2
Erich Keane99eda602017-09-26 18:55:16 +00003extern "C++" struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {
Erich Keane58bd6032017-09-15 16:03:35 +00004 void foo();
Erich Keane3e08f662017-09-29 21:06:00 +00005 // Definitions aren't allowed, unless they are a template.
6 template<typename T>
7 void bar(T t){}
Erich Keane58bd6032017-09-15 16:03:35 +00008};
Erich Keane3e08f662017-09-29 21:06:00 +00009
Erich Keane58bd6032017-09-15 16:03:35 +000010struct IPropertyPageBase : public IUnknown {};
11struct IPropertyPage : public IPropertyPageBase {};
12__interface ISfFileIOPropertyPage : public IPropertyPage {};
13
14
15namespace NS {
16 struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {};
17 // expected-error@+1 {{interface type cannot inherit from}}
Erich Keane3e08f662017-09-29 21:06:00 +000018 __interface IPropertyPageBase : public IUnknown {};
Erich Keane58bd6032017-09-15 16:03:35 +000019}
Erich Keane3e08f662017-09-29 21:06:00 +000020
21namespace NS2 {
22extern "C++" struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {};
Erich Keane58bd6032017-09-15 16:03:35 +000023// expected-error@+1 {{interface type cannot inherit from}}
Erich Keane3e08f662017-09-29 21:06:00 +000024__interface IPropertyPageBase : public IUnknown{};
25}
26
27// expected-error@+1 {{interface type cannot inherit from}}
28__interface IPropertyPageBase2 : public NS::IUnknown {};
Erich Keane58bd6032017-09-15 16:03:35 +000029
30__interface temp_iface {};
31struct bad_base : temp_iface {};
32// expected-error@+1 {{interface type cannot inherit from}}
33__interface bad_inherit : public bad_base{};
34
35struct mult_inher_base : temp_iface, IUnknown {};
36// expected-error@+1 {{interface type cannot inherit from}}
37__interface bad_inherit2 : public mult_inher_base{};
38
39struct PageBase : public IUnknown {};
40struct Page3 : public PageBase {};
41struct Page4 : public PageBase {};
42__interface PropertyPage : public Page4 {};
43
44struct Page5 : public Page3, Page4{};
45// expected-error@+1 {{interface type cannot inherit from}}
Erich Keane3e08f662017-09-29 21:06:00 +000046__interface PropertyPage2 : public Page5 {};
Erich Keane58bd6032017-09-15 16:03:35 +000047
48__interface IF1 {};
Erich Keane3e08f662017-09-29 21:06:00 +000049__interface PP : IUnknown, IF1{};
Erich Keane58bd6032017-09-15 16:03:35 +000050__interface PP2 : PP, Page3, Page4{};