mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 01:18:53 +00:00
3e08f66bb0
Apparently, the MSVC SDK has a strange implementation that causes a number of implicit functions as well as a template member function of the IUnknown type. This patch allows these as InterfaceLike types as well. Additionally, it corrects the behavior where extern-C++ wrapped around an Interface-Like type would permit an interface-like type to exist in a namespace. Differential Revision: https://reviews.llvm.org/D38303 llvm-svn: 314557
51 lines
1.7 KiB
C++
51 lines
1.7 KiB
C++
// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
|
|
|
|
extern "C++" struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {
|
|
void foo();
|
|
// Definitions aren't allowed, unless they are a template.
|
|
template<typename T>
|
|
void bar(T t){}
|
|
};
|
|
|
|
struct IPropertyPageBase : public IUnknown {};
|
|
struct IPropertyPage : public IPropertyPageBase {};
|
|
__interface ISfFileIOPropertyPage : public IPropertyPage {};
|
|
|
|
|
|
namespace NS {
|
|
struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {};
|
|
// expected-error@+1 {{interface type cannot inherit from}}
|
|
__interface IPropertyPageBase : public IUnknown {};
|
|
}
|
|
|
|
namespace NS2 {
|
|
extern "C++" struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {};
|
|
// expected-error@+1 {{interface type cannot inherit from}}
|
|
__interface IPropertyPageBase : public IUnknown{};
|
|
}
|
|
|
|
// expected-error@+1 {{interface type cannot inherit from}}
|
|
__interface IPropertyPageBase2 : public NS::IUnknown {};
|
|
|
|
__interface temp_iface {};
|
|
struct bad_base : temp_iface {};
|
|
// expected-error@+1 {{interface type cannot inherit from}}
|
|
__interface bad_inherit : public bad_base{};
|
|
|
|
struct mult_inher_base : temp_iface, IUnknown {};
|
|
// expected-error@+1 {{interface type cannot inherit from}}
|
|
__interface bad_inherit2 : public mult_inher_base{};
|
|
|
|
struct PageBase : public IUnknown {};
|
|
struct Page3 : public PageBase {};
|
|
struct Page4 : public PageBase {};
|
|
__interface PropertyPage : public Page4 {};
|
|
|
|
struct Page5 : public Page3, Page4{};
|
|
// expected-error@+1 {{interface type cannot inherit from}}
|
|
__interface PropertyPage2 : public Page5 {};
|
|
|
|
__interface IF1 {};
|
|
__interface PP : IUnknown, IF1{};
|
|
__interface PP2 : PP, Page3, Page4{};
|