blob: 3bc3c7d50285de8bd5e23187e05ce0e048e93c3b (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/*
TEST_OUTPUT:
---
fail_compilation/ice10624.d(38): Error: need member function `opCmp()` for struct `Tuple!(Msg)` to compare
fail_compilation/ice10624.d(48): Error: template instance `ice10624.Variant.handler!(Tuple!(Msg))` error instantiating
fail_compilation/ice10624.d(21): instantiated from here: `opAssign!(Tuple!(Msg))`
---
*/
struct Msg {}
struct Tuple(Specs...)
{
Specs expand;
alias expand this;
}
void main()
{
Variant data;
data = Tuple!Msg();
}
struct Variant
{
ptrdiff_t function() fptr = &handler!(void);
static ptrdiff_t handler(A : void)()
{
return 0;
}
static ptrdiff_t handler(A)()
{
A* zis;
A* rhsPA;
{
return *zis < *rhsPA ? -1 : 1;
// Tuple!(Msg) < Tuple!(Msg)
// Tuple!(Msg).expand < Tuple!(Msg).expand
// -> should be error
}
return 0;
}
Variant opAssign(T)(T rhs)
{
fptr = &handler!(T);
return this;
}
}
|