summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/runnable/ice15030.d
blob: 5c9587ca9f614f9a822d89586a6c33bc06b8d727 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// REQUIRED_ARGS: -unittest -boundscheck=off
// PERMUTE_ARGS:
// EXTRA_SOURCES: imports/a15030.d imports/b15030.d
// EXTRA_FILES: imports/std15030algo.d

void main() {}

/+
Compiler output with -v switch.

With 2.068.0:
--------
code      a
code      b
function  b.__unittestL5_2
function  b.__unittestL5_2.__lambda1
function  b.__unittestL5_2.__lambda1.__lambda2
function  b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash
function  b.__unittestL5_2.__lambda1.__lambda2.__lambda2

The nested functions '__lambda1', '__lambda2', and 'filter' are
(fortunately) generated from outer to inner.


With 2.068.1:
--------
code      a
function  b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter
function  b.__unittestL5_2.__lambda1.__lambda2
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash
code      b
function  b.__unittestL5_2
function  b.__unittestL5_2.__lambda1
Assertion failure: '!v->csym' on line 1060 in file 'glue.c'

abnormal program termination

'filer' is generated before its ancestor functions '__lambda1' and '__lambda2' - it's a bug.


Fixed (contains debug prints):
--------
code      a
b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter @[algorithm.d(5)]
    --> pushed to unittest @[b.d(5)]
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash
code      b
function  b.__unittestL5_2
function  b.__unittestL5_2.__lambda1
function  b.__unittestL5_2.__lambda1.__lambda2
function  b.__unittestL5_2.__lambda1.__lambda2.filter!((a) => a).filter!(int[]).filter
function  b.__unittestL5_2.__lambda1.__lambda2.__lambda2

By using `deferredNested` correctly, those nested function generations are ordered again.


Fixed more:
--------
function  D main
code      a
code      b
function  b.__unittestL5_2
function  b.__unittestL5_2.__lambda1
function  b.__unittestL5_2.__lambda1.__lambda2
function  b.__unittestL5_2.__lambda1.__lambda2.filter!(int[]).filter
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.this
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.empty
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.front
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.popFront
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xopEquals
function  b.__unittestL5_2.__lambda1.__lambda2.FilterResult!(__lambda2, int[]).FilterResult.__xtoHash
function  b.__unittestL5_2.__lambda1.__lambda2.__lambda2

By the tweak in TemplateInstance::appendToModuleMember(), all the code of
(implicitly) nested instances are stored into corresponding module object file.

+/