summaryrefslogtreecommitdiffstats
path: root/tests/front-end/diamond.slang
blob: bcb1bbd43a768e42c6fafd026f35eec713267030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
}