158bd6031SErich Keane // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
258bd6031SErich Keane 
399eda60bSErich Keane extern "C++" struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {
458bd6031SErich Keane   void foo();
5*3e08f66bSErich Keane   // Definitions aren't allowed, unless they are a template.
6*3e08f66bSErich Keane   template<typename T>
barIUnknown7*3e08f66bSErich Keane   void bar(T t){}
858bd6031SErich Keane };
9*3e08f66bSErich Keane 
1058bd6031SErich Keane struct IPropertyPageBase : public IUnknown {};
1158bd6031SErich Keane struct IPropertyPage : public IPropertyPageBase {};
1258bd6031SErich Keane __interface ISfFileIOPropertyPage : public IPropertyPage {};
1358bd6031SErich Keane 
1458bd6031SErich Keane 
1558bd6031SErich Keane namespace NS {
1658bd6031SErich Keane   struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {};
1758bd6031SErich Keane   // expected-error@+1 {{interface type cannot inherit from}}
1858bd6031SErich Keane   __interface IPropertyPageBase : public IUnknown {};
1958bd6031SErich Keane }
20*3e08f66bSErich Keane 
21*3e08f66bSErich Keane namespace NS2 {
22*3e08f66bSErich Keane extern "C++" struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {};
23*3e08f66bSErich Keane // expected-error@+1 {{interface type cannot inherit from}}
24*3e08f66bSErich Keane __interface IPropertyPageBase : public IUnknown{};
25*3e08f66bSErich Keane }
26*3e08f66bSErich Keane 
2758bd6031SErich Keane // expected-error@+1 {{interface type cannot inherit from}}
2858bd6031SErich Keane __interface IPropertyPageBase2 : public NS::IUnknown {};
2958bd6031SErich Keane 
3058bd6031SErich Keane __interface temp_iface {};
3158bd6031SErich Keane struct bad_base : temp_iface {};
3258bd6031SErich Keane // expected-error@+1 {{interface type cannot inherit from}}
3358bd6031SErich Keane __interface bad_inherit : public bad_base{};
3458bd6031SErich Keane 
3558bd6031SErich Keane struct mult_inher_base : temp_iface, IUnknown {};
3658bd6031SErich Keane // expected-error@+1 {{interface type cannot inherit from}}
3758bd6031SErich Keane __interface bad_inherit2 : public mult_inher_base{};
3858bd6031SErich Keane 
3958bd6031SErich Keane struct PageBase : public IUnknown {};
4058bd6031SErich Keane struct Page3 : public PageBase {};
4158bd6031SErich Keane struct Page4 : public PageBase {};
4258bd6031SErich Keane __interface PropertyPage : public Page4 {};
4358bd6031SErich Keane 
4458bd6031SErich Keane struct Page5 : public Page3, Page4{};
4558bd6031SErich Keane // expected-error@+1 {{interface type cannot inherit from}}
4658bd6031SErich Keane __interface PropertyPage2 : public Page5 {};
4758bd6031SErich Keane 
4858bd6031SErich Keane __interface IF1 {};
4958bd6031SErich Keane __interface PP : IUnknown, IF1{};
5058bd6031SErich Keane __interface PP2 : PP, Page3, Page4{};
51