summaryrefslogtreecommitdiff
path: root/tests/front-end
diff options
context:
space:
mode:
Diffstat (limited to 'tests/front-end')
-rw-r--r--tests/front-end/diamond.slang32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/front-end/diamond.slang b/tests/front-end/diamond.slang
new file mode 100644
index 000000000..bcb1bbd43
--- /dev/null
+++ b/tests/front-end/diamond.slang
@@ -0,0 +1,32 @@
+// diamond.slang
+
+//TEST:SIMPLE:
+
+// Test to confirm that Slang can handle a "diamond"
+// multiple inheritance pattern between interfaces,
+// without having lookup ambiguity issues at use
+// sites.
+
+interface A { float getA(); }
+
+interface B : A {}
+
+interface C : A {}
+
+interface D : B, C {}
+
+float doIt<T : D>(T value)
+{
+ return value.getA();
+}
+
+struct Thing : D
+{
+ float getA() { return 0.0f; }
+}
+
+float test()
+{
+ Thing thing;
+ return doIt(thing);
+} \ No newline at end of file