Erich Keane | 58bd603 | 2017-09-15 16:03:35 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s |
| 2 | |
Erich Keane | 99eda60 | 2017-09-26 18:55:16 +0000 | [diff] [blame] | 3 | extern "C++" struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown { |
Erich Keane | 58bd603 | 2017-09-15 16:03:35 +0000 | [diff] [blame] | 4 | void foo(); |
Erich Keane | 3e08f66 | 2017-09-29 21:06:00 +0000 | [diff] [blame] | 5 | // Definitions aren't allowed, unless they are a template. |
| 6 | template<typename T> |
| 7 | void bar(T t){} |
Erich Keane | 58bd603 | 2017-09-15 16:03:35 +0000 | [diff] [blame] | 8 | }; |
Erich Keane | 3e08f66 | 2017-09-29 21:06:00 +0000 | [diff] [blame] | 9 | |
Erich Keane | 58bd603 | 2017-09-15 16:03:35 +0000 | [diff] [blame] | 10 | struct IPropertyPageBase : public IUnknown {}; |
| 11 | struct IPropertyPage : public IPropertyPageBase {}; |
| 12 | __interface ISfFileIOPropertyPage : public IPropertyPage {}; |
| 13 | |
| 14 | |
| 15 | namespace NS { |
| 16 | struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {}; |
| 17 | // expected-error@+1 {{interface type cannot inherit from}} |
Erich Keane | 3e08f66 | 2017-09-29 21:06:00 +0000 | [diff] [blame] | 18 | __interface IPropertyPageBase : public IUnknown {}; |
Erich Keane | 58bd603 | 2017-09-15 16:03:35 +0000 | [diff] [blame] | 19 | } |
Erich Keane | 3e08f66 | 2017-09-29 21:06:00 +0000 | [diff] [blame] | 20 | |
| 21 | namespace NS2 { |
| 22 | extern "C++" struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {}; |
Erich Keane | 58bd603 | 2017-09-15 16:03:35 +0000 | [diff] [blame] | 23 | // expected-error@+1 {{interface type cannot inherit from}} |
Erich Keane | 3e08f66 | 2017-09-29 21:06:00 +0000 | [diff] [blame] | 24 | __interface IPropertyPageBase : public IUnknown{}; |
| 25 | } |
| 26 | |
| 27 | // expected-error@+1 {{interface type cannot inherit from}} |
| 28 | __interface IPropertyPageBase2 : public NS::IUnknown {}; |
Erich Keane | 58bd603 | 2017-09-15 16:03:35 +0000 | [diff] [blame] | 29 | |
| 30 | __interface temp_iface {}; |
| 31 | struct bad_base : temp_iface {}; |
| 32 | // expected-error@+1 {{interface type cannot inherit from}} |
| 33 | __interface bad_inherit : public bad_base{}; |
| 34 | |
| 35 | struct mult_inher_base : temp_iface, IUnknown {}; |
| 36 | // expected-error@+1 {{interface type cannot inherit from}} |
| 37 | __interface bad_inherit2 : public mult_inher_base{}; |
| 38 | |
| 39 | struct PageBase : public IUnknown {}; |
| 40 | struct Page3 : public PageBase {}; |
| 41 | struct Page4 : public PageBase {}; |
| 42 | __interface PropertyPage : public Page4 {}; |
| 43 | |
| 44 | struct Page5 : public Page3, Page4{}; |
| 45 | // expected-error@+1 {{interface type cannot inherit from}} |
Erich Keane | 3e08f66 | 2017-09-29 21:06:00 +0000 | [diff] [blame] | 46 | __interface PropertyPage2 : public Page5 {}; |
Erich Keane | 58bd603 | 2017-09-15 16:03:35 +0000 | [diff] [blame] | 47 | |
| 48 | __interface IF1 {}; |
Erich Keane | 3e08f66 | 2017-09-29 21:06:00 +0000 | [diff] [blame] | 49 | __interface PP : IUnknown, IF1{}; |
Erich Keane | 58bd603 | 2017-09-15 16:03:35 +0000 | [diff] [blame] | 50 | __interface PP2 : PP, Page3, Page4{}; |