File: interpret.d

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
file content (3873 lines) | stat: -rw-r--r-- 63,175 bytes parent folder | download | duplicates (2)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
/*
TEST_OUTPUT:
---
true
g
&Test109S(&Test109S(<recursion>))
tfoo
tfoo
Crash!
---
*/

import core.stdc.stdio;

template Tuple(A...)
{
    alias A Tuple;
}

template eval(A...)
{
    const typeof(A[0]) eval = A[0];
}

/************************************************/

int Foo1(int i)
{
    if (i == 0)
        return 1;
    else
        return i * Foo1(i - 1);
}

void test1()
{
    static int f = Foo1(5);
    printf("%d %d\n", f, 5*4*3*2);
    assert(f == 120);
}

/************************************************/

int find2(string s, char c)
{
    if (s.length == 0)
        return -1;
    else if (c == s[0])
        return 0;
    else
        return 1 + find2(s[1..$], c);
}

void test2()
{
    static int f = find2("hello", 'l');
    printf("%d\n", f);
    assert(f == 2);
}

/************************************************/

int bar3(int i)
{
    int j;
    while (i)
    {
        j += i;
        i--;
    }
    return j;
}

void test3()
{
    static b = bar3(7);
    printf("b = %d, %d\n", b, bar3(7));
    assert(b == 28);
}

/************************************************/

int bar4(int i)
{
    for (int j = 0; j < 10; j++)
        i += j;
    return i;
}

void test4()
{
    static b = bar4(7);
    printf("b = %d, %d\n", b, bar4(7));
    assert(b == 52);
}

/************************************************/

int bar5(int i)
{
    int j;
    do
    {
        i += j;
        j++;
    } while (j < 10);
    return i;
}

void test5()
{
    static b = bar5(7);
    printf("b = %d, %d\n", b, bar5(7));
    assert(b == 52);
}

/************************************************/

int bar6(int i)
{
    int j;
    do
    {
        i += j;
        j++;
        if (j == 4)
            break;
    } while (j < 10);
    return i;
}

void test6()
{
    static b = bar6(7);
    printf("b = %d, %d\n", b, bar6(7));
    assert(b == 13);
}

/************************************************/

int bar7(int i)
{
    int j;
    do
    {
        i += j;
        j++;
        if (j == 4)
            return 80;
    } while (j < 10);
    return i;
}

void test7()
{
    static b = bar7(7);
    printf("b = %d, %d\n", b, bar7(7));
    assert(b == 80);
}

/************************************************/

int bar8(int i)
{
    int j;
    do
    {
        j++;
        if (j == 4)
            continue;
        i += j;
    } while (j < 10);
    return i;
}

void test8()
{
    static b = bar8(7);
    printf("b = %d, %d\n", b, bar8(7));
    assert(b == 58);
}

/************************************************/

int bar9(int i)
{
    int j;
    while (j < 10)
    {
        j++;
        if (j == 4)
            continue;
        i += j;
    }
    return i;
}

void test9()
{
    static b = bar9(7);
    printf("b = %d, %d\n", b, bar9(7));
    assert(b == 58);
}

/************************************************/

int bar10(int i)
{
    int j;
    while (j < 10)
    {
        j++;
        if (j == 4)
            break;
        i += j;
    }
    return i;
}

void test10()
{
    static b = bar10(7);
    printf("b = %d, %d\n", b, bar10(7));
    assert(b == 13);
}

/************************************************/

int bar11(int i)
{
    int j;
    while (j < 10)
    {
        j++;
        if (j == 4)
            return i << 3;
        i += j;
    }
    return i;
}

void test11()
{
    static b = bar11(7);
    printf("b = %d, %d\n", b, bar11(7));
    assert(b == 104);
}

/************************************************/

int bar12(int i)
{
    for (int j; j < 10; j++)
    {
        if (j == 4)
            return i << 3;
        i += j;
    }
    return i;
}

void test12()
{
    static b = bar12(7);
    printf("b = %d, %d\n", b, bar12(7));
    assert(b == 104);
}

/************************************************/

int bar13(int i)
{
    for (int j; j < 10; j++)
    {
        if (j == 4)
            break;
        i += j;
    }
    return i;
}

void test13()
{
    static b = bar13(7);
    printf("b = %d, %d\n", b, bar13(7));
    assert(b == 13);
}

/************************************************/

int bar14(int i)
{
    for (int j; j < 10; j++)
    {
        if (j == 4)
            continue;
        i += j;
    }
    return i;
}

void test14()
{
    static b = bar14(7);
    printf("b = %d, %d\n", b, bar14(7));
    assert(b == 48);
}

/************************************************/

int bar15(int i)
{
    foreach (k, v; "hello")
    {
        i <<= 1;
        if (k == 4)
            continue;
        i += v;
    }
    return i;
}

void test15()
{
    static b = bar15(7);
    printf("b = %d, %d\n", b, bar15(7));
    assert(b == 3344);
}

/************************************************/

int bar16(int i)
{
    foreach_reverse (k, v; "hello")
    {
        i <<= 1;
        if (k == 4)
            continue;
        i += v;
    }
    return i;
}

void test16()
{
    static b = bar16(7);
    printf("b = %d, %d\n", b, bar16(7));
    assert(b == 1826);
}

/************************************************/

int bar17(int i)
{
    foreach (k, v; "hello")
    {
        i <<= 1;
        if (k == 2)
            break;
        i += v;
    }
    return i;
}

void test17()
{
    static b = bar17(7);
    printf("b = %d, %d\n", b, bar17(7));
    assert(b == 674);
}

/************************************************/

int bar18(int i)
{
    foreach_reverse (k, v; "hello")
    {
        i <<= 1;
        if (k == 2)
            break;
        i += v;
    }
    return i;
}

void test18()
{
    static b = bar18(7);
    printf("b = %d, %d\n", b, bar18(7));
    assert(b == 716);
}

/************************************************/

int bar19(int i)
{
    assert(i > 0);
    foreach_reverse (k, v; "hello")
    {
        i <<= 1;
        if (k == 2)
            return 8;
        i += v;
    }
    return i;
}

void test19()
{
    static b = bar19(7);
    printf("b = %d, %d\n", b, bar19(7));
    assert(b == 8);
}

/************************************************/

int bar20(int i)
{
    assert(i > 0);
    foreach (k, v; "hello")
    {
        i <<= 1;
        if (k == 2)
            return 8;
        i += v;
    }
    return i;
}

void test20()
{
    static b = bar20(7);
    printf("b = %d, %d\n", b, bar20(7));
    assert(b == 8);
}

/************************************************/

int bar21(int i)
{
    assert(i > 0);
    foreach (v; Tuple!(57, 23, 8))
    {
        i <<= 1;
        i += v;
    }
    return i;
}

void test21()
{
    static b = bar21(7);
    printf("b = %d, %d\n", b, bar21(7));
    assert(b == 338);
}

/************************************************/

int bar22(int i)
{
    assert(i > 0);
    foreach_reverse (v; Tuple!(57, 23, 8))
    {
        i <<= 1;
        i += v;
    }
    return i;
}

void test22()
{
    static b = bar22(7);
    printf("b = %d, %d\n", b, bar22(7));
    assert(b == 191);
}

/************************************************/

int bar23(int i)
{
    assert(i > 0);
    foreach_reverse (v; Tuple!(57, 23, 8))
    {
        i <<= 1;
        if (v == 23)
            return i + 1;
        i += v;
    }
    return i;
}

void test23()
{
    static b = bar23(7);
    printf("b = %d, %d\n", b, bar23(7));
    assert(b == 45);
}

/************************************************/

int bar24(int i)
{
    assert(i > 0);
    foreach (v; Tuple!(57, 23, 8))
    {
        i <<= 1;
        if (v == 23)
            return i + 1;
        i += v;
    }
    return i;
}

void test24()
{
    static b = bar24(7);
    printf("b = %d, %d\n", b, bar24(7));
    assert(b == 143);
}

/************************************************/

int bar25(int i)
{
    assert(i > 0);
    foreach_reverse (v; Tuple!(57, 23, 8))
    {
        i <<= 1;
        if (v == 23)
            break;
        i += v;
    }
    return i;
}

void test25()
{
    static b = bar25(7);
    printf("b = %d, %d\n", b, bar25(7));
    assert(b == 44);
}

/************************************************/

int bar26(int i)
{
    assert(i > 0);
    foreach (v; Tuple!(57, 23, 8))
    {
        i <<= 1;
        if (v == 23)
            break;
        i += v;
    }
    return i;
}

void test26()
{
    static b = bar26(7);
    printf("b = %d, %d\n", b, bar26(7));
    assert(b == 142);
}

/************************************************/

int bar27(int i)
{
    foreach_reverse (v; Tuple!(57, 23, 8))
    {
        i <<= 1;
        if (v == 23)
            continue;
        i += v;
    }
    return i;
}

void test27()
{
    static b = bar27(7);
    printf("b = %d, %d\n", b, bar27(7));
    assert(b == 145);
}

/************************************************/

int bar28(int i)
{
    foreach (v; Tuple!(57, 23, 8))
    {
        i <<= 1;
        if (v == 23)
            continue;
        i += v;
    }
    return i;
}

void test28()
{
    static b = bar28(7);
    printf("b = %d, %d\n", b, bar28(7));
    assert(b == 292);
}

/************************************************/

int bar29(int i)
{
    switch (i)
    {
        case 1:
            i = 4;
            break;
        case 7:
            i = 3;
            break;
        default: assert(0);
    }
    return i;
}

void test29()
{
    static b = bar29(7);
    printf("b = %d, %d\n", b, bar29(7));
    assert(b == 3);
}

/************************************************/

int bar30(int i)
{
    switch (i)
    {
        case 1:
            i = 4;
            break;
        case 8:
            i = 2;
            break;
        default:
            i = 3;
            break;
    }
    return i;
}

void test30()
{
    static b = bar30(7);
    printf("b = %d, %d\n", b, bar30(7));
    assert(b == 3);
}

/************************************************/

int bar31(string s)
{   int i;

    switch (s)
    {
        case "hello":
            i = 4;
            break;
        case "betty":
            i = 2;
            break;
        default:
            i = 3;
            break;
    }
    return i;
}

void test31()
{
    static b = bar31("betty");
    printf("b = %d, %d\n", b, bar31("betty"));
    assert(b == 2);
}

/************************************************/

int bar32(int i)
{
    switch (i)
    {
        case 7:
            i = 4;
            goto case;
        case 5:
            i = 2;
            break;
        default:
            i = 3;
            break;
    }
    return i;
}

void test32()
{
    static b = bar32(7);
    printf("b = %d, %d\n", b, bar32(7));
    assert(b == 2);
}

/************************************************/

int bar33(int i)
{
    switch (i)
    {
        case 5:
            i = 2;
            break;
        case 7:
            i = 4;
            goto case 5;
        default:
            i = 3;
            break;
    }
    return i;
}

void test33()
{
    static b = bar33(7);
    printf("b = %d, %d\n", b, bar33(7));
    assert(b == 2);
}

/************************************************/

int bar34(int i)
{
    switch (i)
    {
        default:
            i = 3;
            break;
        case 5:
            i = 2;
            break;
        case 7:
            i = 4;
            goto default;
    }
    return i;
}

void test34()
{
    static b = bar34(7);
    printf("b = %d, %d\n", b, bar34(7));
    assert(b == 3);
}

/************************************************/

int bar35(int i)
{
  L1:
    switch (i)
    {
        default:
            i = 3;
            break;
        case 5:
            i = 2;
            break;
        case 3:
            return 8;
        case 7:
            i = 4;
            goto default;
    }
    goto L1;
}

void test35()
{
    static b = bar35(7);
    printf("b = %d, %d\n", b, bar35(7));
    assert(b == 8);
}

/************************************************/

int square36(int x)
{
    return x * x;
}

const int foo36 = square36(5);

void test36()
{
    assert(foo36 == 25);
}

/************************************************/

string someCompileTimeFunction()
{
    return "printf(\"Wowza!\n\");";
}

void test37()
{
    mixin(someCompileTimeFunction());
}

/************************************************/

string NReps(string x, int n)
{
    string ret = "";
    for (int i = 0; i < n; i++)
    {
        ret ~= x;
    }
    return ret;
}

void test38()
{
    static x = NReps("3", 6);
    assert(x == "333333");
}

/************************************************/

bool func39() { return true; }

static if (func39())
{
    pragma(msg, "true");
}
else
{
    pragma(msg, "false");
}

void test39()
{
}

/************************************************/

string UpToSpace(string x)
{
    int i = 0;
    while (i < x.length && x[i] != ' ')
    {
        i++;
    }
    return x[0..i];
}

void test40()
{
    const y = UpToSpace("first space was after first");
    assert(y == "first");
}

/************************************************/

int bar41(ref int j)
{
    return 5;
}

int foo41(int i)
{
    int x;
    x = 3;
    bar41(x);
    return i + x;
}

void test41()
{
    const y = foo41(3);
    assert(y == 6);
}

/************************************************/

int bar42(ref int j)
{
    return 5;
}

int foo42(int i)
{
    int x;
    x = 3;
    bar42(x);
    return i + x;
}

void test42()
{
    const y = foo42(3);
    assert(y == 6);
}

/************************************************/

int bar(string a)
{
    int v;
    for (int i = 0; i < a.length; i++)
    {
        if (a[i] != ' ')
        {
            v += a.length;
        }
    }
    return v;
}

void test43()
{
    const int foo = bar("a b c d");
    assert(foo == 28);
}

/************************************************/

string foo44() { return ("bar"); }

void test44()
{
    const string bar = foo44();
    assert(bar == "bar");
}

/************************************************/

int square45(int n) { return (n * n); }

void test45()
{
    int bar = eval!(square45(5));
    assert(bar == 25);
}

/************************************************/

const int[5] foo46 = [0,1,2,3,4];

void test46()
{
    printf("%d\n", eval!(foo46[3]));
}

/************************************************/

string foo47()
{
    string s;
    s = s ~ 't';
    return s ~ "foo";
}

void test47()
{
    static const x = foo47();
    pragma(msg, x);
    assert(x == "tfoo");
}

/************************************************/

string foo48()
{
    string s;
    s = s ~ 't';
    s = s.idup;
    return s ~ "foo";
}

void test48()
{
    static const x = foo48();
    pragma(msg, x);
    assert(x == "tfoo");
}

/************************************************/

dstring testd49(dstring input)
{
    if (input[3..5] != "rt")
    {
        return input[1..3];
    }
    return "my";
}

void test49()
{
    static x = testd49("hello");
    assert(x == "el");
}

/************************************************/

string makePostfix50(int x)
{
    string first;
    first = "bad";
    if (x)
    {
        first = "ok";
        makePostfix50(0);
    }
    return first;
}

void test50()
{
    static const char [] q2 = makePostfix50(1);
    static assert(q2 == "ok", q2);
}

/************************************************/

int exprLength(string s)
{
    int numParens=0;
    for (int i = 0; i < s.length; ++i)
    {
        if (s[i] == '(') { numParens++; }
        if (s[i] == ')') { numParens--; }
        if (numParens == 0) { return i; }
    }
    assert(0);
}

string makePostfix51(string operations)
{
    if (operations.length < 2)
        return "x";
    int x = exprLength(operations);
    string first="bad";
    if (x > 0)
    {
        first = "ok";
        string ignore = makePostfix51(operations[1..x]);
    }
    return first;
}


void test51()
{
    string q = makePostfix51("(a+b)*c");
    assert(q == "ok");
    static const string q2 = makePostfix51("(a+b)*c");
    static assert(q2 == "ok");
    static assert(makePostfix51("(a+b)*c") == "ok");
}

/************************************************/

int foo52(ref int x)
{
    x = 7;
    return 3;
}

int bar52(int y)
{
    y = 4;
    foo52(y);
    return y;
}

void test52()
{
    printf("%d\n", bar52(2));
    static assert(bar52(2) == 7);
}

/************************************************/

void bar53(out int x) { x = 2; }

int foo53() { int y; bar53(y); return y; }

void test53()
{
    const int z = foo53();
    assert(z == 2);
}

/************************************************/

void test54()
{
    static assert(equals54("alphabet", "alphabet"));
}

bool equals54(string a, string b)
{
    return (a == b);
}

/************************************************/

const string[2] foo55 = ["a", "b"];
string retsth55(int i) { return foo55[i]; }

void test55()
{
    enum res1 = eval!(foo55[0]);
    printf("%.*s\n", cast(int)res1.length, res1.ptr);
    enum res2 = eval!(retsth55(0));
    printf("%.*s\n", cast(int)res2.length, res2.ptr);
}

/************************************************/

string retsth56(int i)
{
    static const string[2] foo = ["a", "b"];
    return foo[i];
}

void test56()
{
    enum result = eval!(retsth56(0));
    printf("%.*s\n", cast(int)result.length, result.ptr);
}

/************************************************/

int g57()
{
    pragma(msg, "g");
    return 2;
}

const int a57 = g57();

void test57()
{
    assert(a57 == 2);
}

/************************************************/

int[] Fun58(int x)
{
    int[] result;
    result ~= x + 1;
    return result;
}

void test58()
{
    static b = Fun58(1) ~ Fun58(2);
    assert(b.length == 2);
    assert(b[0] == 2);
    assert(b[1] == 3);
}

/************************************************/

int Index59()
{
    int[] data = [1];
    return data[0];
}

void test59()
{
    static assert(Index59() == 1);
}

/************************************************/

string[int] foo60()
{
    return [3:"hello", 4:"betty"];
}

void test60()
{
    static assert(foo60()[3] == "hello");
    static assert(foo60()[4] == "betty");
}

/************************************************/

string[int] foo61()
{
    return [3:"hello", 4:"betty", 3:"world"];
}

void test61()
{
    static assert(foo61()[3] == "world");
    static assert(foo61()[4] == "betty");
}

/************************************************/

string foo62(int k)
{
    string[int] aa;
    aa = [3:"hello", 4:"betty"];
    return aa[k];
}

void test62()
{
    static assert(foo62(3) == "hello");
    static assert(foo62(4) == "betty");
}

/************************************************/

void test63()
{
    static auto x = foo63();
}

int foo63()
{
    pragma(msg, "Crash!");
    return 2;
}

/************************************************/

dstring testd64(dstring input)
{
    debug int x = 10;
    return "my";
}

void test64()
{
    static x = testd64("hello");
}

/************************************************/

struct S65
{
    int i;
    int j = 3;
}

int foo(S65 s1, S65 s2)
{
    return s1 == s2;
}

void test65()
{
    static assert(foo(S65(1, 5), S65(1, 5)) == 1);
    static assert(foo(S65(1, 5), S65(1, 4)) == 0);
}

/************************************************/

struct S66
{
    int i;
    int j = 3;
}

int foo66(S66 s1)
{
    return s1.j;
}

void test66()
{
    static assert(foo66(S66(1, 5)) == 5);
}

/************************************************/

struct S67
{
    int i;
    int j = 3;
}

int foo67(S67 s1)
{
    s1.j = 3;
    int i = (s1.j += 2);
    assert(i == 5);
    return s1.j + 4;
}

void test67()
{
    static assert(foo67(S67(1, 5)) == 9);
}

/************************************************/

int foo68(int[] a)
{
    a[1] = 3;
    int x = (a[0] += 7);
    assert(x == 8);
    return a[0] + a[1];
}

void test68()
{
    static assert(foo68( [1,5] ) == 11);
}

/************************************************/

int foo69(char[] a)
{
    a[1] = 'c';
    char x = (a[0] += 7);
    assert(x == 'h');
    assert(x == a[0]);
    return a[0] + a[1] - 'a';
}

void test69()
{
    static assert(foo69(['a', 'b']) == 'j');
}

/************************************************/

int foo70(int[string] a)
{
    a["world"] = 5;
    auto x = (a["hello"] += 7);
    assert(x == 10);
    assert(x == a["hello"]);
    return a["hello"] + a["betty"] + a["world"];
}

void test70()
{
    static assert(foo70(["hello":3, "betty":4]) == 19);
}

/************************************************/

size_t foo71(int[string] a)
{
    return a.length;
}

void test71()
{
    static assert(foo71(["hello":3, "betty":4]) == 2);
}

/************************************************/

string[] foo72(int[string] a)
{
    return a.keys;
}

void test72()
{
    static assert(foo72(["hello":3, "betty":4]) == ["hello", "betty"]);
}

/************************************************/

int[] foo73(int[string] a)
{
    return a.values;
}

void test73()
{
    static assert(foo73(["hello":3, "betty":4]) == [3, 4]);
}

/************************************************/

bool b74()
{
    string a = "abc";
    return (a[$-1] == 'c');
}

const c74 = b74();

void test74()
{
    assert(c74 == true);
}

/************************************************/

struct FormatSpec
{
    uint leading;
    bool skip;
    uint width;
    char modifier;
    char format;
    uint formatStart;
    uint formatLength;
    uint length;
}

FormatSpec GetFormat(string s)
{
    FormatSpec result;
    return result;
}

FormatSpec GetFormat2(string s)
{
    FormatSpec result = FormatSpec();
    result.length = 0;
    assert(result.length < s.length);
    while (result.length < s.length)
    {
        ++result.length;
    }
    return result;
}

void test75()
{
    static FormatSpec spec = GetFormat("asd");

    assert(spec.leading == 0);
    assert(spec.modifier == char.init);

    static FormatSpec spec2 = GetFormat2("asd");
    assert(spec2.length == 3);
}

/************************************************/

int f76()
{
    int[3] a = void;
    a[0] = 1;
    assert(a[0] == 1);
    return 1;
}

const i76 = f76();

void test76()
{
}

/************************************************/

struct V77
{
    int a;
    int b;
}

V77 f77()
{
    int q = 0;
    int unused;
    int unused2;
    return V77(q, 0);
}

void test77()
{
    const w = f77();
    const v = f77().b;
}

/************************************************/

struct Bar78
{
    int x;
}

int foo78()
{
    Bar78 b = Bar78.init;
    Bar78 c;
    b.x = 1;
    b = bar(b);
    return b.x;
}

Bar78 bar(Bar78 b)
{
    return b;
}

void test78()
{
    static x = foo78();
}

/************************************************/

struct Bar79
{
    int y,x;
}

int foo79()
{
    Bar79 b = Bar79.init;

    b.x = 100;

    for (size_t i = 0; i < b.x; i++) { }

    b.x++;
    b.x = b.x + 1;

    return b.x;
}

void test79()
{
    static x = foo79();
    printf("x = %d\n", x);
    assert(x == 102);
}

/************************************************/

void test80()
{
}

/************************************************/

string foo81()
{
    return "";
}

string rod81(string[] a)
{
    return a[0];
}

void test81()
{
    static x = rod81([foo81(), ""]);
    assert(x == "");
}


/************************************************/

struct S82
{
    string name;
}

const S82 item82 = {"item"};

string mixItemList82()
{
    return item82.name;
}

const string s82 = mixItemList82();

void test82()
{
    assert(s82 == "item");
}

/************************************************/

struct S83
{
    string name;
}

const S83[] items83 =
[
    {"item"},
];

string mixItemList83()
{
    string s;
    foreach (item; items83)
        s ~= item.name;
    return s;
}

const string s83 = mixItemList83();

void test83()
{
    assert(s83 == "item");
}

/************************************************/

struct S84 { int a; }

int func84()
{
    S84 [] s = [S84(7)];
    return s[0].a; // Error: cannot evaluate func() at compile time
}

void test84()
{
    const int x = func84();
    assert(x == 7);
}

/************************************************/

struct S85
{
    int a;
}

size_t func85()
{
    S85 [] s;
    s ~= S85(7);
    return s.length;
}

void test85()
{
    const size_t x = func85();
    assert(x == 1);
}

/************************************************/

struct Bar86
{
    int x;
    char[] s;
}

char[] foo86()
{
    Bar86 bar;
    return bar.s;
}

void test86()
{
    static x = foo86();
    assert(x == null);
}

/************************************************/

struct Bar87
{
    int x;
}

int foo87()
{
    Bar87 bar;
    bar.x += 1;
    bar.x++;
    return bar.x;
}

void test87()
{
    static x = foo87();
    assert(x == 2);
}

/************************************************/

int foo88()
{
    char[] s;
    int i;

    if (s)
    {
        i |= 1;
    }

    if (s == null)
    {
        i |= 2;
    }

    if (s is null)
    {
        i |= 4;
    }

    if (s == "")
    {
        i |= 8;
    }

    if (s.length)
    {
        i |= 16;
    }

    if (s == ['c'][0..0])
    {
        i |= 32;
    }


    if (null == s)
    {
        i |= 64;
    }

    if (null is s)
    {
        i |= 128;
    }

    if ("" == s)
    {
        i |= 256;
    }

    if (['c'][0..0] == s)
    {
        i |= 512;
    }

    return i;
}

void test88()
{
    static x = foo88();
    printf("x = %x\n", x);
    assert(x == (2|4|8|32|64|128|256|512));
}

/************************************************/

template Tuple89(T...)
{
    alias T val;
}

alias Tuple89!(int) Tup89;

string gen89()
{
    foreach (i, type; Tup89.val)
    {
        assert(i == 0);
        assert(is(type == int));
    }
    return null;
}

void test89()
{
    static const string text = gen89();
    assert(text is null);
}

/************************************************/

string bar90(string z)
{
    return z;
}

string foo90(string a, string b)
{
    string f = a.length == 1 ? a: foo90("B", "C");
    string g = b.length == 1 ? b: bar90(foo90("YYY", "A"));
    return  f;
}

void test90()
{
    static const string xxx = foo90("A", "xxx");
    printf("%.*s\n", cast(int)xxx.length, xxx.ptr);
    assert(xxx == "A");
}

/************************************************/

struct PR91
{
}

int foo91()
{
    PR91 pr;
    pr = PR91();
    return 0;
}

void test91()
{
    static const i = foo91();
}

/************************************************/

char find92(immutable(char)[7] buf)
{
    return buf[3];
}


void test92()
{
    static const pos = find92("abcdefg");
    assert(pos == 'd');
}

/************************************************/

static string hello93()
{
    string result = "";
    int i = 0;
    for (;;)
    {
        result ~= `abc`;
        i += 1;
        if (i == 3)
            break;
    }
    return result;
}

void test93()
{
    static string s = hello93();
    assert(s == "abcabcabc");
}

/************************************************/

int foo94 (string[] list, string s)
{
    if (list.length == 0)
        return 1;
    else
    {
        return 2 + foo94(list[1..$], list[0]);
    }
}

void test94()
{
    printf("test94\n");
    static const int x = foo94(["a", "b"], "");
    assert(x == 5);
}

/************************************************/

char[] func95(immutable char[] s)
{
    char[] u = "".dup;
    u ~= s;
    u = u ~ s;
    return u;
}

void test95()
{
    mixin(func95("{}"));
}

/************************************************/

char[] func96(string s)
{
    char[] u = "".dup;
    u ~= s;
    u = u ~ s;
    return u;
}

void test96()
{
    mixin(func96("{}"));
}

/************************************************/

string foo97()
{
    string a;
    a ~= "abc"; // ok
    string[] b;
    b ~= "abc"; // ok
    string[][] c;
    c ~= ["abc", "def"];
    string[][] d = [];
    d ~= ["abc", "def"]; // ok
    return "abc";
}

void test97()
{
    static const xx97 = foo97();
}

/************************************************/

immutable(int)[] foo98(immutable(int)[][] ss)
{
    immutable(int)[] r;
    r ~= ss[0]; // problem here
    return r;
}

void test98()
{
    const r = foo98([[1], [2]]);
}

/************************************************/

struct Number
{
    public int value;
    static Number opCall(int value)
    {
        Number n = void;
        n.value = value;
        return n;
    }
}

class Crash
{
    Number number = Number(0);
}

void test99()
{
}

/************************************************/

int[] map100 = ([4:true, 5:true]).keys;
bool[] foo100 = ([4:true, 5:true]).values;

void test100()
{
}

/************************************************/

int foo101()
{
    immutable bool [int] map = [4:true, 5:true];
    foreach (x; map.keys) {}
    return 3;
}

static int x101 = foo101();

void test101()
{
}

/************************************************/

int foo102()
{
    foreach (i; 0 .. 1)
        return 1;
    return 0;
}
static assert(foo102() == 1);

int bar102()
{
    foreach_reverse (i; 0 .. 1)
        return 1;
    return 0;
}
static assert(bar102() == 1);

void test102()
{
}

/************************************************/

int foo103()
{
    foreach (c; '0' .. '9') {  }
    foreach_reverse (c; '9' .. '0') {  }
    return 0;
}

enum x103 = foo103();

void test103()
{
}

/************************************************/

struct S
{
    int x;
    char y;
}

// Functions which should fail CTFE

int badfoo()
{
    S[2] c;
    int w = 4;
    c[w].x = 6;  // array bounds error
    return 7;
}

int badglobal = 1;

int badfoo3()
{
    S[2] c;
    c[badglobal].x = 6;  // global index error
    return 7;
}

int badfoo4()
{
    static S[2] c;
    c[0].x = 6;  // Cannot access static
    return 7;
}

/+ // This doesn't compile at runtime
int badfoo5()
{
    S[] c = void;
    c[0].x = 6;  // c is uninitialized, and not a static array.
    return 1;
}
+/

int badfoo6()
{
    S[] b = [S(7), S(15), S(56), S(12)];
    b[-2..4] = S(17); // exceeding (negative) array bounds
    return 1;
}

int badfoo7()
{
    S[] b = [S(7), S(15), S(56), S(12), S(67)];
    S[] c = [S(17), S(4)];
    b[1..4] = c[]; // slice mismatch in dynamic array
    return 1;
}

int badfoo8()
{
    S[] b;
    b[1..3] = [S(17), S(4)]; // slice assign to uninitialized dynamic array
    return 1;
}

template Compileable(int z) { bool OK = true;}
static assert(!is(typeof(Compileable!(badfoo()).OK)));
static assert(!is(typeof(Compileable!(
(){
    S[] c;
    return c[7].x;  // uninitialized error
}()).OK
)));
static assert( is(typeof(Compileable!(0).OK)));
static assert(!is(typeof(Compileable!(badfoo3()).OK)));
static assert(!is(typeof(Compileable!(badfoo4()).OK)));
//static assert(!is(typeof(Compileable!(badfoo5()).OK)));
static assert(!is(typeof(Compileable!(badfoo6()).OK)));
static assert(!is(typeof(Compileable!(badfoo7()).OK)));
static assert(!is(typeof(Compileable!(badfoo8()).OK)));

// Functions which should pass CTFE

int goodfoo1()
{
    int[8] w;           // use static array in CTFE
    w[] = 7;            // full slice assign
    w[$ - 1] = 538;     // use of $ in index assignment
    assert(w[6] == 7);
    return w[7];
}
static assert(goodfoo1() == 538);

int goodfoo2()
{
    S[4] w = S(101);    // Block-initialize array of structs
    w[$ - 2].x = 917;   // use $ in index member assignment
    w[$ - 2].y = 58;    // this must not clobber the prev assignment
    return w[2].x;      // check we got the correct one
}
static assert(goodfoo2() == 917);

static assert(is(typeof(Compileable!(
(){
    S[4] w = void;      // uninitialized array of structs
    w[$ - 2].x = 217;   // initialize one member
    return w[2].x;
}()).OK
)));

int goodfoo4()
{
    S[4] b = [S(7), S(15), S(56), S(12)];   // assign from array literal
    assert(b[3] == S(12));
    return b[2].x - 55;
}
static assert(goodfoo4()==1);

int goodfoo5()
{
    S[4] b = [S(7), S(15), S(56), S(12)];
    b[0..2] = [S(2), S(6)];         // slice assignment from array literal
    assert(b[3] == S(12));
    assert(b[1] == S(6));
    return b[0].x;
}
static assert(goodfoo5() == 2);
static assert(goodfoo5() == 2);     // check for memory corruption

int goodfoo6()
{
    S[6] b = void;
    b[2..5] = [S(2), S(6), S(17)];  // slice assign to uninitialized var
    assert(b[4] == S(17));
    return b[3].x;
}
static assert(goodfoo6() == 6);

int goodfoo7()
{
    S[8] b = void;
    b[2..5] = S(217);   // slice assign to uninitialized var
    assert(b[4] == S(217));
    return b[3].x;
}
static assert(goodfoo7() == 217);

int goodfoo8()
{
    S[] b = [S(7), S(15), S(56), S(12), S(67)];
    b[2..4] = S(17);    // dynamic array block slice assign
    assert(b[3] == S(17));
    assert(b[4] == S(67));
    return b[0].x;
}
static assert(goodfoo8() == 7);

// --------- CTFE MEMBER FUNCTION TESTS --------
struct Q
{
    int x;
    char y;
    int opOpAssign(string op)(int w) if (op == "+")
    {
        x += w;
        return x + w;
    }
    Q opOpAssign(string op)(int w) if (op == "-")
    {
        x -= w;
        version(D_Version2) { mixin("return this;"); } else { mixin("return *this;"); }
    }
    int boo()  { return 4; }
    int coo()  { return x; }
    int foo()  { return coo(); }
    int doo(int a)
    {
        Q z = Q(a, 'x');
        z.x += 5;
        return z.coo() + 3 * x;
    }
    void goo(int z) { x = z; }
    int hoo(int y, int z) { return y + z; }
    void joo(int z)
    {
        x += z;
    }
}

int memtest1()
{
    Q b = Q(15, 'a');
    return b.hoo(3, 16);    // simple const function
}

static assert(memtest1() == 19);

int memtest2()
{
    Q b = Q(15, 'x');
    b.x -= 10;
    return b.coo();
}

static assert(memtest2() == 5);

int memtest3()
{
    Q b = Q(15, 'x');
    b.x -= 10;
    return b.foo();
}

static assert(memtest3() == 5);

int memtest4()
{
    Q b = Q(12, 'x');
    return b.doo(514);
}
static assert(memtest4() == 519 + 3 * 12);


int memtest5()
{
    Q b = Q(132, 'x');
    b.goo(4178);    // Call modifying member
    return b.x;
}
static assert(memtest5() == 4178);

int memtest6()
{
    Q q = Q(1);
    q += 3;         // operator overloading
    return q.x;
}
static assert(memtest6() == 4);

static assert(!is(typeof(Compileable!(Q += 2).OK)));    // Mustn't cause segfault

int memtest7()
{
    Q q = Q(57);
    q -= 35;
    return q.x;
}

static assert(memtest7() == 57 - 35);

int memtest8()
{
    Q[3] w;
    w[2].x = 17;
    w[2].joo(6);    // Modify member of array
    w[1].x += 18;
    return w[2].coo();
}

static assert(memtest8() == 6 + 17);

// --------- CTFE REF PASSING TESTS --------

// https://issues.dlang.org/show_bug.cgi?id=1950 - CTFE doesn't work correctly for structs passed by ref
struct S1950
{
    int x;
}

int foo1950()
{
    S1950 s = S1950(5);     // explicitly initialized
    bar1950(s);
    return s.x;
}

void bar1950(ref S1950 w)
{
    w.x = 10;
}

static assert(foo1950() == 10); // OK <- Fails, x is 0

int foo1950b()
{
    S1950 s;  // uninitialized
    bar1950(s);
    return s.x;
}

static assert(foo1950b() == 10); // OK <- Fails, x is 0


// More extreme case, related to 1950

void bar1950c(ref int w)
{
    w = 87;
}

int foo1950c()
{
    int[5] x;
    x[] = 56;
    bar1950c(x[1]);     // Non-trivial ref parameters
    return x[1];
}

static assert(foo1950c() == 87);

void bar1950d(ref int[] w)
{
    w[1..$] = 87;
    w[0] += 15;
}

int foo1950d()
{
    int[] x = [1, 2, 3, 4, 5];
    x[1..$] = 56;
    bar1950d(x);    // Non-trivial ref parameters
    assert(x[0] == 16);
    return x[1];
}

static assert(foo1950d() == 87);

// Nested functions
int nested(int x)
{
    int y = 3;
    int inner(int w)
    {
        int z = 2;
        ++z;
        y += w;
        return x + 3;
    }

    int z = inner(14);
    assert(y == 17);
    inner(8);
    assert(y == 17 + 8);
    return z + y;
}

static assert(nested(7) == 17 + 8 + 10);
static assert(nested(7) == 17 + 8 + 10);

// Recursive nested functions

int nested2(int x)
{
   int y = 3;
   int inner(int w)
    {
        int z = 2;
        ++z;
        ++y;
        if (w <= 1)
            return x + 3;
        else
            return inner(w - 1);
    }

   int z = inner(14);
   assert(y == 17);

   inner(8);
   assert(y == 17 + 8);
   return z + y;
}

static assert(nested2(7) == 17 + 8 + 10);

// https://issues.dlang.org/show_bug.cgi?id=1605
// D1 & D2. break in switch with goto breaks in ctfe
int bug1605()
{
    int i = 0;
    while (true)
    {
        goto LABEL;
    LABEL:
        if (i != 0)
            return i;
        i = 27;
    }
    assert(i == 27);
    return 88; // unreachable
}

static assert(bug1605() == 27);

// https://issues.dlang.org/show_bug.cgi?id=2564
// D2 only. CTFE: the index in a tuple foreach is uninitialized (bogus error)
// NOTE: Beware of optimizer bug 3264.

int bug2564()
{
    version(D_Version2) { mixin("enum int Q = 0;"); }else {mixin("int Q = 0;"); }
    string [2] s = ["a", "b"];
    assert(s[Q].dup == "a");
    return 0;
}

static int bug2564b = bug2564();


// https://issues.dlang.org/show_bug.cgi?id=1461
// D1 + D2. Local variable as template alias parameter breaks CTFE
void bug1461()
{
    int x;
    static assert(Gen1461!(x).generate() == null);
}

template Gen1461(alias A)
{
    string generate()
    {
        return null;
    }
}

/************************************************/

string foo104(string[] a...)
{
    string result = "";
    foreach (s; a)
        result ~= s;
    return result;
}

mixin (foo104("int ", "x;"));

/************************************************/

struct SwineFlu
{
    int a;
    int b;
}

struct Infection
{
    SwineFlu y;
}

struct IveGotSwineFlu
{
    Infection x;
    int z;
    int oink() { return x.y.a + 10; }
}

int quarantine()
{
    IveGotSwineFlu d;
    return d.oink();
}

struct Mexico
{
    Infection x;
    int z = 2;
    int oink() { return z + x.y.b; }
}

int mediafrenzy()
{
    Mexico m;
    return m.oink;
}

static assert(quarantine() == 10);
static assert(mediafrenzy() == 2);

/************************************************/

int ctfeArrayTest(int z)
{
    int[] a = new int[z];
    a[$ - 3] = 6;
    assert(a.length == z);
    return a[$ - 3];
}
static assert(ctfeArrayTest(15) == 6);

/************************************************/

char bugzilla1298()
{
    char [4] q = "abcd".dup;
    char [4] r = ['a', 'b', 'c', 'd'];
    assert(q == r);
    q[0..2] = "xy";
    q[2] += 3;
    return q[2];
}

static assert(bugzilla1298() == 'f');

int bugzilla1790(Types...)()
{
    foreach (T; Types)
    {
    }
    return 0;
}

const int bugs1790 = bugzilla1790!("")();

char ctfeStrTest1()
{
    char [8] s = void;
    s[2..4] = 'x';

   assert(s.length == 8);
   return s[3];
}

static assert(ctfeStrTest1() == 'x');

//--------- DELEGATE TESTS ------

// Function + delegate literals inside CTFE
int delegtest1()
{
    assert(function int(int a){ return 7 + a; }(16) == 23);
    return delegate int(int a){ return 7 + a; }(6);
}

int delegtest2()
{
    int innerfunc1()
    {
        return delegate int(int a){ return 7 + a; }(6);
    }
    int delegate() f = &innerfunc1;
    return 3 * f();
}

int delegtest3()
{
    int function() f = &delegtest1;
    return 3 * f();
}

struct DelegStruct
{
    int a;
    int bar(int x) { return a + x; }
}

int delegtest4()
{
    DelegStruct s;
    s.a = 5;
    auto f = &s.bar;
    return f(3);
}

alias int delegate(int) DelegType;

// Test arrays of delegates
int delegtest5()
{
    DelegStruct s;
    s.a = 5;
    DelegType[4] w;
    w[] = &s.bar;
    return w[2](3);
}

// Test arrays of structs of delegates
struct FoolishStruct
{
    DelegType z;
}

int delegtest6()
{
    DelegStruct s;
    s.a = 5;
    FoolishStruct[3] k;
    DelegType u = &s.bar;
    k[1].z = u;
    return k[1].z(3);
}

static assert(delegtest1() == 13);
static assert(delegtest2() == 39);
static assert(delegtest3() == 39);
static assert(delegtest4() == 8);
static assert(delegtest5() == 8);
static assert(delegtest6() == 8);

// Function + delegate literals, module scope
static assert(function int(int a){ return 17 + a; }(16) == 33);
static assert(            (int a){ return  7 + a; }(16) == 23);

// --- Test lazy ---
int lazyTest1(lazy int y)
{
    return y + 1;
}

int lazyTest2(int x)
{
    return lazyTest1(x);
}

static assert(lazyTest1(7) == 8);
static assert(lazyTest2(17) == 18);

/************************************************/

version(D_Version2)
{
// https://issues.dlang.org/show_bug.cgi?id=4020
// https://issues.dlang.org/show_bug.cgi?id=4027
// D2 only
struct PostblitCrash
{
    int x;
    mixin("this(this) { ++x; }");
}

int bug4020()
{
    PostblitCrash f;
    f.x = 3;
    f = f;
    f = f;
    return f.x;
}
static assert(bug4020() == 5);

string delegate() bug4027(string s)
{
    return { return s; };
}

// If it compiles, it must not generate wrong code on D2.
static if (is(typeof((){ static const s = bug4027("aaa")(); }()))) {
    static assert(bug4027("aaa")() == "aaa");
    static assert(bug4027("bbb")() == "bbb");
}
}

// ---

void bug4004a(ref int a)
{
    assert(a == 7);
    a += 3;
}

void bug4004b(ref int b)
{
    b = 7;
    bug4004a(b);
}

int bug4004c()
{
    int offset = 5;
    bug4004b(offset);
    return offset;
}

static assert(bug4004c() == 10);

// ---

int bug4019()
{
    int[int] aa;
    aa[1] = 2;
    aa[4] = 6;
    return aa[1] + aa[4];
}
static assert(bug4019() == 8);

// ---

string delegate() bug4029a()
{
    return { return "abc"[]; };
}

string bug4029()
{
   return bug4029a()();
}

static assert(bug4029() == "abc");

/************************************************/

int bug4078()
{
    int[] arr = new int[1];
    return arr[0];
}
static assert(bug4078() == 0);

int bug4052()
{
    int[] arr = new int[1];
    int s;
    foreach (x; arr)
        s += x;
    foreach (x; arr)
        s += x * x;
    return 4052;
}
static assert(bug4052() == 4052);

int bug4252()
{
    char [] s = "abc".dup;
    s[15] = 'd';    // Array bounds error
    return 3;
}

static assert(!is(typeof(Compileable!(bug4252()))));

size_t setlen1()
{
    int[] w = new int[4];
    w[] = 7;
    w.length = 6;
    return 21 + w.length;
}

static assert(setlen1() == 27);

size_t setlen2()
{
    int[] w;
    w.length = 15;
    assert(w[3] == 0);
    w[2] = 8;
    w[14] = 7;
    w.length = 12;  // check shrinking
    assert(w[2] == 8);
    return 2 + w.length;
}

static assert(setlen2() == 14);

/************************************************/

int bug4257(ref int x)
{
    return 3;
}

int bug4257c(int x)
{
    return 3;
}

struct Struct4257
{
    int foo() { return 2; }
}

void bug4257b()
{
    int y;
    static assert(!is(typeof(Compileable!(bug4257(y)))));
    static assert(!is(typeof(Compileable!(bug4257c(y)))));
    Struct4257 s;
    static assert(!is(typeof(Compileable!(s.foo()))));
}

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=5117

static int dummy5117 = test5117();

int test5117()
{
    S5117 s;
    s.change();
    assert(s.value == 1);       // (7) succeeds

    R5117 r;
    r.s.change();
    assert(r.s.value == 1);     // (11) fails, value == 0

    return 0;
}

struct S5117
{
    int value;
    void change() { value = 1; }
}

struct R5117
{
    S5117 s;
}

/************************************************/

enum dummy5117b = test5117b();

int test5117b()
{
    S5117b s;
    getRef5117b(s).change();
    assert(s.value == 1);     // fails, value == 0
    return 0;
}
ref S5117b getRef5117b(return ref S5117b s) { return s; }

struct S5117b
{
    int value;
    void change() { value = 1; }
}

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=6439

struct A6439
{
    this(uint a, uint b)
    {
        begin = a;
        end = b;
    }
    union
    {
        struct
        {
            uint begin, end;
        }
        uint[2] arr;
    }
}

void test6439()
{
    enum y = A6439(10, 20);
    A6439 y2 = A6439(10, 20);
    assert(y2.begin == y.begin && y2.end == y.end);  //passes
    assert(y.arr != [0,0]);
    assert(y.arr == [10,20]);
    assert(y.arr == y2.arr);
}

/************************************************/
// from tests/fail_compilation/fail147

static assert(!is(typeof(Compileable!(
    (int i){
        int x = void;
        ++x; // used before initialization
        return i + x;
    }(3)
))));

// https://issues.dlang.org/show_bug.cgi?id=6504 regression
void test6504()
{
    for (int i = 0; i < 3; ++i)
    {
        char[] x2 = "xxx" ~ ['c'];
        assert(x2[1] == 'x');
        x2[1] = 'q';
    }
}

// https://issues.dlang.org/show_bug.cgi?id=8818 regression
void test8818()
{
    static bool test()
    {
        string op1 = "aa";
        string op2 = "b";
        assert("b" >= "aa");
        assert(op2 >= op1);
        return true;
    }
    static assert(test());
    assert(test());
}

/************************************************/

struct Test104Node
{
    int val;
    Test104Node* next;
}

Test104Node* CreateList(int[] arr)
{
    if (!arr.length)
        return null;
    Test104Node* ret = new Test104Node;
    ret.val = arr[0];
    ret.next = CreateList(arr[1..$]);
    return ret;
}

const(Test104Node)* root = CreateList([1, 2, 3, 4, 5]);

void test104()
{
    assert(root.val == 1);
    assert(root.next.val == 2);
    assert(root.next.next.val == 3);
    assert(root.next.next.next.val == 4);
    assert(root.next.next.next.next.val == 5);
}

/************************************************/

interface ITest105a
{
    string test105a() const;
}

class Test105a : ITest105a
{
    char a;
    int b;
    char c = 'C';
    int d = 42;
    string test105a() const { return "test105a"; }
}

interface ITest105b
{
    string test105b() const;
}

class Test105b : Test105a, ITest105b
{
    char e;
    int f;
    this(char _e, int _f, char _a, int _b) pure
    {
        e = _e;
        f = _f;
        a = _a;
        b = _b;
    }
    string test105b() const { return "test105b"; }
}

    const Test105b  t105b  = new Test105b('E', 88, 'A', 99);
    const Test105a  t105a  = new Test105b('E', 88, 'A', 99);
    const ITest105b t105ib = new Test105b('E', 88, 'A', 99);
    const ITest105a t105ia = new Test105b('E', 88, 'A', 99);
__gshared Test105b  t105gs = new Test105b('E', 88, 'A', 99);
   shared Test105b  t105bs = new    shared(Test105b)('E', 88, 'A', 99);
immutable Test105b  t105bi = new immutable(Test105b)('E', 88, 'A', 99);

void test105()
{
    assert(t105b.a == 'A');
    assert(t105b.b == 99);
    assert(t105b.c == 'C');
    assert(t105b.d == 42);
    assert(t105b.e == 'E');
    assert(t105b.f == 88);
    assert(t105b.test105a() == "test105a");
    assert(t105b.test105b() == "test105b");

    assert(t105a.a == 'A');
    assert(t105a.b == 99);
    assert(t105a.c == 'C');
    assert(t105a.d == 42);
    assert(t105a.test105a() == "test105a");

    assert(t105ia.test105a() == "test105a");
    assert(t105ib.test105b() == "test105b");

    assert(t105a.classinfo is Test105b.classinfo);
    //t105b.d = -1;
    //assert(t105b.d == -1);
    //assert(t105a.d == 42);

    assert(t105gs.a == 'A');
    assert(t105gs.b == 99);
    assert(t105gs.c == 'C');
    assert(t105gs.d == 42);
    assert(t105gs.e == 'E');
    assert(t105gs.f == 88);
    assert(t105gs.test105a() == "test105a");
    assert(t105gs.test105b() == "test105b");

    assert(t105bs.a == 'A');
    assert(t105bs.b == 99);
    assert(t105bs.c == 'C');
    assert(t105bs.d == 42);
    assert(t105bs.e == 'E');
    assert(t105bs.f == 88);

    assert(t105bi.a == 'A');
    assert(t105bi.b == 99);
    assert(t105bi.c == 'C');
    assert(t105bi.d == 42);
    assert(t105bi.e == 'E');
    assert(t105bi.f == 88);
    assert(t105bi.test105a() == "test105a");
    assert(t105bi.test105b() == "test105b");
}

int bug9938()
{
    assert(t105ia.test105a() == "test105a");
    return 1;
}

static assert(t105ia.test105a() == "test105a");
static assert(bug9938());

/************************************************/

struct Test106
{
    Test106* f;
    Test106* s;
}

Test106* ctfe106()
{
    auto s = new Test106;
    auto s2 = new Test106;
    s.f = s2;
    s.s = s2;
    assert(s.f is s.s);
    return s;
}

const(Test106)* t106 = ctfe106();

void test106()
{
    assert(t106.f is t106.s);
}

/************************************************/

class Test107
{
    Test107 a;
    Test107 b;

    this()
    {
    }

    this(int)
    {
        a = new Test107();
        b = a;
        assert(a is b);
    }
}

const Test107 t107 = new Test107(1);

void test107()
{
    assert(t107.a is t107.b);
}

/************************************************/

/*
interface Getter
{
    int getNum() const;
}

class Test108 : Getter
{
    int f;
    this(int v) inout
    {
        f = v;
    }

    int getNum() const
    {
        return f;
    }
}

enum const(Test108) t108 = new Test108(38);

void test108()
{
    const Test108 obj = t108;
    assert(obj.classinfo is Test108.classinfo);
    assert(obj.f == 38);

    const Getter iobj = t108;
    assert(iobj.getNum() == 38);
    assert((cast(Object)iobj).classinfo is Test108.classinfo);
    assert(t108 is t108);
}
*/

/***** https://issues.dlang.org/show_bug.cgi?id=5678 *****/

/*
struct Bug5678
{
    this(int) {}
}

enum const(Bug5678)* b5678 = new const(Bug5678)(0);

void test5678()
{
    assert(b5678 is b5678);
}*/

/************************************************/

class Test109C { this(){ this.c = this; } Test109C c; }
const t109c = new Test109C();

struct Test109S { this(int){ this.s = &this; } Test109S* s; }
const t109s = new Test109S(0);
pragma(msg, t109s); // Make sure there is no infinite recursion.

void test109()
{
    assert(t109c.c is t109c);
    assert(t109s.s is t109s);
}

/************************************************/

struct Test110f { int f1; Test110s f2; }
struct Test110s { this(int, int, int){} }
auto test110 = [Test110f(1, Test110s(1, 2, 3))];

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=6907
// FIXME: Shouldn't this go in core.memory now that `delete` has been removed?

int test6907()
{
    import core.memory : __delete;

    int dtor1;
    class C { ~this() { ++dtor1; } }

    // delete on Object
    { Object o; if (!__ctfe) __delete(o); }
    { scope o = new Object(); }
    { Object o = new Object(); if (!__ctfe) __delete(o); }

    // delete on C
    {
        C c;
        if (!__ctfe)
            __delete(c);
    }
    {
        { scope c = new C(); }
        assert(dtor1 == 1);
    }
    {
        { scope Object o = new C(); }
        assert(dtor1 == 2);
    }
    {
        C c = new C();
        if (__ctfe)
        {
            c.__dtor();
            c = null;
        }
        else
            __delete(c);
        assert(dtor1 == 3);
    }
    {
        Object o = new C();
        if (__ctfe)
        {
            (cast(C)o).__dtor();
            o = null;
        }
        else
            __delete(o);
        assert(dtor1 == 4);
    }

    int dtor2;
    struct S1 { ~this() { ++dtor2; } }

    // delete on S1
    {
        S1* p;
        // https://issues.dlang.org/show_bug.cgi?id=22779
        // Uncomment after druntime fix
        version (none)
        {
            if (!__ctfe)
                __delete(p);
        }
    }
    {
        S1* p = new S1();
        if (__ctfe)
        {
            (*p).__dtor();
            destroy(p);
        }
        else
            __delete(p);
        assert(dtor2 == 1);
    }

    // delete on S1[]
    {
        S1[] a = [S1(), S1()];
        if (__ctfe)
        {
            a[1].__dtor();
            a[0].__dtor();
            destroy(a);
        }
        else
            __delete(a);
        assert(dtor2 == 3);
    }

    return 1;
}
static assert(test6907());

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=9023

bool test9023()
{
    string[][string] aas;
    assert(aas.length == 0);
    aas["a"] ~= "anything";
    assert(aas.length == 1);
    assert(aas["a"] == ["anything"]);
    aas["a"] ~= "more";
    assert(aas.length == 1);
    assert(aas["a"] == ["anything", "more"]);

    int[int] aan;
    assert(aan.length == 0);
    auto x = aan[0]++;
    assert(x == 0);
    assert(aan.length == 1);
    assert(aan[0] == 1);

    return true;
}
static assert(test9023());

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=15817

S[] split15817(S)(S s)
{
    size_t istart;
    S[] result;

    foreach (i, c ; s)
        result ~= s[istart .. i];
    return result;
}

int test15817()
{
    auto targets = `a1`.split15817;
    uint[string] counts;
    foreach (a; targets)
        counts[a]++;
    assert(counts == ["":1u, "a":1]);
    return 1;
}
static assert(test15817());

/************************************************/

interface IBug9954
{
    string foo() const;
}

class Bug9954 : IBug9954
{
    string foo() const { return "hello"; }
}

IBug9954 makeIBug9954()
{
    return new Bug9954;
}

const IBug9954 b9954 = makeIBug9954();

void test9954()
{
    assert(b9954.foo() == "hello");
}

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=10483

struct Bug10483
{
    int[3][4] val;
}

struct Outer10483
{
    Bug10483 p = Bug10483(67);
}

int k10483a = Outer10483.init.p.val[2][2];   // ICE(expression.c)

void test10483()
{
    int k10483b = Outer10483.init.p.val[2][2]; // Segfault (backend/type.c)
}

/************************************************/

struct S10669 { uint x; }

static const S10669 iid0_10669 = S10669(0);

class C10669
{
    static const S10669 iid1_10669 = S10669(1);
};

const S10669 IID0_10669 = iid0_10669;
const S10669 IID1_10669 = C10669.iid1_10669;

/************************************************/

TypeInfo getTi()
{
    return typeid(int);
}

auto t112 = getTi();

void test112()
{
    assert(t112.toString() == "int");
}

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=10687

enum Foo10687 : uint { A, B, C, D, E }
immutable uint[5][] m10687 = [[0, 1, 2, 3, 4]];

void test10687()
{
    static immutable uint[5] a1 = [0, 1, 2, 3, 4];
    auto   a2 = cast(immutable(Foo10687[5]))a1;
    static a3 = cast(immutable(Foo10687[5]))a1;

    auto   foos1 = cast(immutable(Foo10687[5][]))m10687;
    static foos2 = cast(immutable(Foo10687[5][]))m10687;
}

/************************************************/

void test113()
{
    import core.math;

    static void compare(real a, real b)
    {
        assert(fabs(a - b) < 128 * real.epsilon);
    }

    static if (__traits(compiles, (){ enum real ctval1 = yl2x(3.14, 1); }))
    {
        enum real ctval1 = yl2x(3.14, 1);
        enum real ctval2 = yl2x(2e1500L, 3);
        enum real ctval3 = yl2x(1, 5);

        real rtval1 = yl2x(3.14, 1);
        real rtval2 = yl2x(2e1500L, 3);
        real rtval3 = yl2x(1, 5);

        compare(ctval1, rtval1);
        compare(ctval2, rtval2);
        compare(ctval3, rtval3);
    }

    static if (__traits(compiles, (){ enum real ctval4 = yl2xp1(3.14, 1); }))
    {
        enum real ctval4 = yl2xp1(3.14, 1);
        enum real ctval5 = yl2xp1(2e1500L, 3);
        enum real ctval6 = yl2xp1(1, 5);

        real rtval4 = yl2xp1(3.14, 1);
        real rtval5 = yl2xp1(2e1500L, 3);
        real rtval6 = yl2xp1(1, 5);

        compare(ctval4, rtval4);
        compare(ctval5, rtval5);
        compare(ctval6, rtval6);
    }
}

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=14140

struct S14140
{
    union
    {
        float[3][1] A;
        float[3] flat;
    }

    this(in float[] args...)
    {
        flat[] = args[];
    }
}

class C14140
{
    union
    {
        float[3][1] A;
        float[3] flat;
    }

    this(in float[] args...)
    {
        flat[] = args[];
    }
}

immutable s14140 = S14140(0, 1, 0);
const c14140 = new C14140(0, 1, 0);

void test14140()
{
    auto s = s14140;
    assert(s.flat == [0, 1, 0]);

    auto c = c14140;
    assert(c.flat == [0, 1, 0]);
}

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=14862

struct S14862
{
    union
    {
        struct { uint hi, lo; }
        ulong data;
    }

    this(ulong data)
    {
        this.data = data;
    }
}

void test14862()
{
           S14862 s14862 = S14862(123UL);
      enum S14862 e14862 = S14862(123UL);
    static S14862 g14862 = S14862(123UL);

    assert(s14862.data == 123UL);   // OK
    assert(e14862.data == 123UL);   // OK
    assert(g14862.data == 123UL);   // OK <- fail
}

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=15681

void test15681()
{
    static struct A { float value; }

    static struct S
    {
        A[2] values;

        this(float)
        {
            values[0].value = 0;
            values[1].value = 1;
        }
    }

    auto s1 = S(1.0f);
    assert(s1.values[0].value == 0);        // OK
    assert(s1.values[1].value == 1);        // OK

    enum s2 = S(1.0f);
    static assert(s2.values[0].value == 0); // OK <- NG
    static assert(s2.values[1].value == 1); // OK
    assert(s2.values[0].value == 0);        // OK <- NG
    assert(s2.values[1].value == 1);        // OK
}

/************************************************/
// toPrec

void testToPrec()
{
    import core.math;

    enum real ctpir = 0xc.90fdaa22168c235p-2;
    enum double ctpid = 0x1.921fb54442d18p+1;
    enum float ctpif = 0x1.921fb6p+1;
    static assert(toPrec!float(ctpir) == ctpif);
    static assert(toPrec!double(ctpir) == ctpid);
    static assert(toPrec!real(ctpir) == ctpir);
    static assert(toPrec!float(ctpid) == ctpif);
    static assert(toPrec!double(ctpid) == ctpid);
    static assert(toPrec!real(ctpid) == ctpid);
    static assert(toPrec!float(ctpif) == ctpif);
    static assert(toPrec!double(ctpif) == ctpif);
    static assert(toPrec!real(ctpif) == ctpif);

    assert(toPrec!float(ctpir) == ctpif);
    assert(toPrec!double(ctpir) == ctpid);
    assert(toPrec!real(ctpir) == ctpir);
    assert(toPrec!float(ctpid) == ctpif);
    assert(toPrec!double(ctpid) == ctpid);
    assert(toPrec!real(ctpid) == ctpid);
    assert(toPrec!float(ctpif) == ctpif);
    assert(toPrec!double(ctpif) == ctpif);
    assert(toPrec!real(ctpif) == ctpif);

    static real rtpir = 0xc.90fdaa22168c235p-2;
    static double rtpid = 0x1.921fb54442d18p+1;
    static float rtpif = 0x1.921fb6p+1;
    assert(toPrec!float(rtpir) == rtpif);
    assert(toPrec!double(rtpir) == rtpid);
    assert(toPrec!real(rtpir) == rtpir);
    assert(toPrec!float(rtpid) == rtpif);
    assert(toPrec!double(rtpid) == rtpid);
    assert(toPrec!real(rtpid) == rtpid);
    assert(toPrec!float(rtpif) == rtpif);
    assert(toPrec!double(rtpif) == rtpif);
    assert(toPrec!real(rtpif) == rtpif);
}

/************************************************/

auto test20366()
{
    const(char)[] s = ['h', 'e', 'l', '\xef', '\xbd', '\x8c', 'o'];

    foreach_reverse (dchar c; s)
    {
    }

    return true;
}
static assert(test20366());

/************************************************/

bool test20400()
{
    char[] s = cast(char[])"1234";
    char[] ret = s[2 .. $];
    ret.length += 1;
    ret[$-1] = '5';
    assert(ret == "345");

    return true;
}
static assert(test20400());

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=21878

struct A21878
{
    int i;
    ref inout(int) opIndex(size_t idx) inout return { return i; }
}

struct B21878
{
    A21878[1] a;
    ref inout(int) opIndex(size_t idx) inout return { return a[0][idx]; }
}

bool ctfeFunc21878()
{
    A21878 a;
    a[0] = 42;
    assert(a[0] == 42); // OK

    B21878 b;
    b[0] = 42;
    assert(b[0] == 42); // OK <- fails

    return true;
}

void test21878()
{
    enum eval = ctfeFunc21878();
    ctfeFunc21878(); // succeeds at runtime
}

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=20133

void bar20133(ref string text)
{
    text = text[1 .. $];
    assert(text.length < 3);
    if (text.length == 2) assert(text == "oo");
    if (text.length == 1) assert(text == "o");
    if (text.length == 0) assert(text == "");
    string tcopy = text;
    if (tcopy.length > 0)
        bar20133(tcopy);
    assert(tcopy.length < 2);
    if (tcopy.length == 1) assert(tcopy == "o");
    if (tcopy.length == 0) assert(tcopy == "");
}

void bar20133_2(ref string text)
{
    auto ptext = &text;
    *ptext = text[1 .. $];
    assert(text.length < 3);
    if (text.length == 2) assert(text == "oo");
    if (text.length == 1) assert(text == "o");
    if (text.length == 0) assert(text == "");
    string tcopy = text;
    if (tcopy.length > 0)
        bar20133_2(tcopy);
    assert(tcopy.length < 2);
    if (tcopy.length == 1) assert(tcopy == "o");
    if (tcopy.length == 0) assert(tcopy == "");
}

alias fun20133 = {
    string input = "foo";
    bar20133(input);
    assert(input == "oo");
    return input;
};

alias fun20133_2 = {
    string input = "foo";
    bar20133_2(input);
    assert(input == "oo");
    return input;
};

void test20133()
{
    enum ctest = fun20133();
    enum ctest2 = fun20133_2();
    auto rtest = fun20133();
    auto rtest2 = fun20133_2();
}

/************************************************/
// https://issues.dlang.org/show_bug.cgi?id=22530

class D22530 { }

class C22530
{
    D22530 y = new D22530;
    alias y this;
}

void test22530()
{
    // fixed
    static assert(cast(D22530)(new C22530) is null);
    static assert((1 ? cast(D22530)(new C22530) : new D22530) is null);

    // runtime version already works
    assert(cast(D22530)(new C22530) is null);
    assert((1 ? cast(D22530)(new C22530) : new D22530) is null);
}

/************************************************/

int main()
{
    test1();
    test2();
    test3();
    test4();
    test5();
    test6();
    test7();
    test8();
    test9();
    test10();
    test11();
    test12();
    test13();
    test14();
    test15();
    test16();
    test17();
    test18();
    test19();
    test20();
    test21();
    test22();
    test23();
    test24();
    test25();
    test26();
    test27();
    test28();
    test29();
    test30();
    test31();
    test32();
    test33();
    test34();
    test35();
    test36();
    test37();
    test38();
    test39();
    test40();
    test41();
    test42();
    test43();
    test44();
    test45();
    test46();
    test47();
    test48();
    test49();
    test50();
    test51();
    test52();
    test53();
    test54();
    test55();
    test56();
    test57();
    test58();
    test59();
    test60();
    test61();
    test62();
    test63();
    test64();
    test65();
    test66();
    test67();
    test68();
    test69();
    test70();
    test71();
    test72();
    test73();
    test74();
    test75();
    test76();
    test77();
    test78();
    test79();
    test80();
    test81();
    test82();
    test83();
    test84();
    test85();
    test86();
    test87();
    test88();
    test89();
    test90();
    test91();
    test92();
    test93();
    test94();
    test95();
    test96();
    test97();
    test98();
    test99();
    test100();
    test101();
    test102();
    test103();
    test104();
    test105();
    test106();
    test107();
    //test108();
    test109();
    test112();
    test113();
    test6439();
    test6504();
    test8818();
    test6907();
    test9023();
    test15817();
    test9954();
    test14140();
    test14862();
    test15681();
    test20366();
    test20400();
    test21878();
    test20133();
    test22530();

    printf("Success\n");
    return 0;
}