summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/ms-iunknown.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2017-09-15 16:03:35 +0000
committerErich Keane <erich.keane@intel.com>2017-09-15 16:03:35 +0000
commit58bd603109e4e6ca214712ca897d024bed07ef0f (patch)
treef4864509cdc5bb0e7bdf3502de05b680272f11db /clang/test/SemaCXX/ms-iunknown.cpp
parentf34537dff8e75704d699bca7b6a03a6949c50c61 (diff)
downloadbcm5719-llvm-58bd603109e4e6ca214712ca897d024bed07ef0f.tar.gz
bcm5719-llvm-58bd603109e4e6ca214712ca897d024bed07ef0f.zip
Fix the __interface inheritence rules to work better with IUnknown and IDispatch
__interface objects in MSVC are permitted to inherit from __interface types, and interface-like types. Additionally, there are two default interface-like types (IUnknown and IDispatch) that all interface-like types must inherit from. Differential Revision: https://reviews.llvm.org/D37308 llvm-svn: 313364
Diffstat (limited to 'clang/test/SemaCXX/ms-iunknown.cpp')
-rw-r--r--clang/test/SemaCXX/ms-iunknown.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/ms-iunknown.cpp b/clang/test/SemaCXX/ms-iunknown.cpp
new file mode 100644
index 00000000000..c965a4c0a1b
--- /dev/null
+++ b/clang/test/SemaCXX/ms-iunknown.cpp
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
+
+struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {
+ void foo();
+};
+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 {};
+}
+// 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{};
OpenPOWER on IntegriCloud