summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/runnable/template9.d
blob: 0b11c6b4fa319b8016b929b498099f5a40dd3433 (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
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
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
// PERMUTE_ARGS:

module breaker;

import core.stdc.stdio, core.vararg;

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

U foo(T, U)(U i)
{
    return i + 1;
}

int foo(T)(int i)
{
    return i + 2;
}

void test1()
{
    auto i = foo!(int)(2L);
//    assert(i == 4);    // now returns 3
}

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

U foo2(T, U)(U i)
{
    return i + 1;
}

void test2()
{
    auto i = foo2!(int)(2L);
    assert(i == 3);
}

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

class Foo3
{
    T bar(T,U)(U u)
    {
        return cast(T)u;
    }
}

void test3()
{
  Foo3 foo = new Foo3;
  int i = foo.bar!(int)(1.0);
  assert(i == 1);
}


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

T* begin4(T)(T[] a) { return a.ptr; }

void copy4(string pred = "", Ranges...)(Ranges rs)
{
    alias rs[$ - 1] target;
    pragma(msg, typeof(target).stringof);
    auto tb = begin4(target);//, te = end(target);
}

void test4()
{
    int[] a, b, c;
    copy4(a, b, c);
    // comment the following line to prevent compiler from crashing
    copy4!("a > 1")(a, b, c);
}

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

import std.stdio:writefln;

template foo5(T,S)
{
    void foo5(T t, S s) {
        writefln("typeof(T)=",typeid(T)," typeof(S)=",typeid(S));
    }
}

template bar5(T,S)
{
    void bar5(S s) {
        writefln("typeof(T)=",typeid(T),"typeof(S)=",typeid(S));
    }
}


void test5()
{
    foo5(1.0,33);
    bar5!(double,int)(33);
    bar5!(float)(33);
}

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

int foo6(T...)(auto ref T x)
{   int result;

    foreach (i, v; x)
    {
        if (v == 10)
            assert(__traits(isRef, x[i]));
        else
            assert(!__traits(isRef, x[i]));
        result += v;
    }
    return result;
}

void test6()
{   int y = 10;
    int r;
    r = foo6(8);
    assert(r == 8);
    r = foo6(y);
    assert(r == 10);
    r = foo6(3, 4, y);
    assert(r == 17);
    r = foo6(4, 5, y);
    assert(r == 19);
    r = foo6(y, 6, y);
    assert(r == 26);
}

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

auto ref min(T, U)(auto ref T lhs, auto ref U rhs)
{
    return lhs > rhs ? rhs : lhs;
}

void test7()
{   int x = 7, y = 8;
    int i;

    i = min(4, 3);
    assert(i == 3);
    i = min(x, y);
    assert(i == 7);
    min(x, y) = 10;
    assert(x == 10);
    static assert(!__traits(compiles, min(3, y) = 10));
    static assert(!__traits(compiles, min(y, 3) = 10));
}

/**********************************/
// 5946

template TTest8()
{
    int call(){ return this.g(); }
}
class CTest8
{
    int f() { mixin TTest8!(); return call(); }
    int g() { return 10; }
}
void test8()
{
    assert((new CTest8()).f() == 10);
}

/**********************************/
// 693

template TTest9(alias sym)
{
    int call(){ return sym.g(); }
}
class CTest9
{
    int f1() { mixin TTest9!(this); return call(); }
    int f2() { mixin TTest9!this; return call(); }
    int g() { return 10; }
}
void test9()
{
    assert((new CTest9()).f1() == 10);
    assert((new CTest9()).f2() == 10);
}

/**********************************/
// 1780

template Tuple1780(Ts ...) { alias Ts Tuple1780; }

template Decode1780( T )                            { alias Tuple1780!() Types; }
template Decode1780( T : TT!(Us), alias TT, Us... ) { alias Us Types; }

void test1780()
{
    struct S1780(T1, T2) {}

    // should extract tuple (bool,short) but matches the first specialisation
    alias Decode1780!( S1780!(bool,short) ).Types SQ1780;  // --> SQ2 is empty tuple!
    static assert(is(SQ1780 == Tuple1780!(bool, short)));
}

/**********************************/
// 1659

class Foo1659 { }
class Bar1659 : Foo1659 { }

void f1659(T : Foo1659)() { }
void f1659(alias T)() { static assert(false); }

void test1659()
{
    f1659!Bar1659();
}

/**********************************/
// 2025

struct S2025 {}
void f2025() {}

template Foo2025(int i) { enum Foo2025 = 1; }
template Foo2025(TL...) { enum Foo2025 = 2; }
static assert(Foo2025!1 == 1);
static assert(Foo2025!int == 2);
static assert(Foo2025!S2025 == 2);
static assert(Foo2025!f2025 == 2);

template Bar2025(T)    { enum Bar2025 = 1; }
template Bar2025(A...) { enum Bar2025 = 2; }
static assert(Bar2025!1 == 2);
static assert(Bar2025!int == 1);    // 2 -> 1
static assert(Bar2025!S2025 == 1);  // 2 -> 1
static assert(Bar2025!f2025 == 2);

template Baz2025(T)       { enum Baz2025 = 1; }
template Baz2025(alias A) { enum Baz2025 = 2; }
static assert(Baz2025!1 == 2);
static assert(Baz2025!int == 1);
static assert(Baz2025!S2025 == 1);  // 2 -> 1
static assert(Baz2025!f2025 == 2);

/**********************************/
// 3608

template foo3608(T, U){}

template BaseTemplate3608(alias TTT : U!V, alias U, V...)
{
    alias U BaseTemplate3608;
}
template TemplateParams3608(alias T : U!V, alias U, V...)
{
    alias V TemplateParams3608;
}

template TyueTuple3608(T...) { alias T TyueTuple3608; }

void test3608()
{
    alias foo3608!(int, long) Foo3608;

    static assert(__traits(isSame, BaseTemplate3608!Foo3608, foo3608));
    static assert(is(TemplateParams3608!Foo3608 == TyueTuple3608!(int, long)));
}

/**********************************/
// 5015

import breaker;

static if (is(ElemType!(int))){}

template ElemType(T) {
  alias _ElemType!(T).type ElemType;
}

template _ElemType(T) {
    alias r type;
}

/**********************************/
// 5185

class C5185(V)
{
    void f()
    {
        C5185!(C5185!(int)) c;
    }
}

void test5185()
{
    C5185!(C5185!(int)) c;
}

/**********************************/
// 5893

class C5893
{
    int concatAssign(C5893 other) { return 1; }
    int concatAssign(int other) { return 2; } // to demonstrate overloading

    template opOpAssign(string op) if (op == "~")
    { alias concatAssign opOpAssign; }

    int opOpAssign(string op)(int other) if (op == "+") { return 3; }
}

void test5893()
{
    auto c = new C5893;
    assert(c.opOpAssign!"~"(c) == 1); // works
    assert(c.opOpAssign!"~"(1) == 2); // works
    assert((c ~= 1) == 2);
    assert((c += 1) == 3);  // overload
}

/**********************************/
// 5988

template Templ5988(alias T)
{
    alias T!int Templ5988;
}

class C5988a(T) { Templ5988!C5988a foo; }
//Templ5988!C5988a foo5988a;    // Commented version
void test5988a() { C5988a!int a; }  // Was error, now works

class C5988b(T) { Templ5988!C5988b foo; }
Templ5988!C5988b foo5988b;      // Uncomment version
void test5988b() { C5988b!int a; }  // Works

/**********************************/
// 6404

// receive only rvalue
void rvalue(T)(auto ref T x) if (!__traits(isRef, x)) {}
void rvalueVargs(T...)(auto ref T x) if (!__traits(isRef, x[0])) {}

// receive only lvalue
void lvalue(T)(auto ref T x) if ( __traits(isRef, x)) {}
void lvalueVargs(T...)(auto ref T x) if ( __traits(isRef, x[0])) {}

void test6404()
{
    int n;

    static assert(!__traits(compiles, rvalue(n)));
    static assert( __traits(compiles, rvalue(0)));

    static assert( __traits(compiles, lvalue(n)));
    static assert(!__traits(compiles, lvalue(0)));

    static assert(!__traits(compiles, rvalueVargs(n)));
    static assert( __traits(compiles, rvalueVargs(0)));

    static assert( __traits(compiles, lvalueVargs(n)));
    static assert(!__traits(compiles, lvalueVargs(0)));
}

/**********************************/
// 2246

class A2246(T,d){
    T p;
}

class B2246(int rk){
    int[rk] p;
}

class C2246(T,int rk){
    T[rk] p;
}

template f2246(T:A2246!(U,d),U,d){
    void f2246(){ }
}

template f2246(T:B2246!(rank),int rank){
    void f2246(){ }
}

template f2246(T:C2246!(U,rank),U,int rank){
    void f2246(){ }
}

void test2246(){
    A2246!(int,long) a;
    B2246!(2) b;
    C2246!(int,2) c;
    f2246!(A2246!(int,long))();
    f2246!(B2246!(2))();
    f2246!(C2246!(int,2))();
}

/**********************************/
// 2296

void foo2296(size_t D)(int[D] i...){}
void test2296()
{
    foo2296(1, 2, 3);
}

/**********************************/
// 1684

template Test1684( uint memberOffset ){}

class MyClass1684 {
    int flags2;
    mixin Test1684!(cast(uint)flags2.offsetof) t1; // compiles ok
    mixin Test1684!(cast(int)flags2.offsetof)  t2; // compiles ok
    mixin Test1684!(flags2.offsetof)           t3; // Error: no property 'offsetof' for type 'int'
}

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

void bug4984a(int n)() if (n > 0 && is(typeof(bug4984a!(n-1) ()))) {
}

void bug4984a(int n : 0)() {
}

void bug4984b(U...)(U args) if ( is(typeof( bug4984b(args[1..$]) )) ) {
}

void bug4984b(U)(U u) {
}

void bug4984() {
  // Note: compiling this overflows the stack if dmd is build with DEBUG
  //bug4984a!400();
    bug4984a!200();
    bug4984b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19);
}

/***************************************/
// 2579

void foo2579(T)(T delegate(in Object) dlg)
{
}

void test2579()
{
    foo2579( (in Object o) { return 15; } );
}

/**********************************/
// 2803

auto foo2803(T)(T t = 0) { return t; }

struct S2803 {}
S2803 s2803;
ref S2803 getS2803() { return s2803; }
auto fun2803(T, U)(T t, ref U u = getS2803)
{
    static assert(is(U == S2803));
    return &u;
}

// from the past version of std.conv
template to2803(T) { T to2803(S)(S src) { return T.init; } }
auto toImpl2803a(T, S)(S s, in T left, in T sep = ", ", in T right = "]") {}
auto toImpl2803b(T, S)(S s, in T left = to2803!T(S.stringof~"("), in T right = ")") {}
auto toImpl2803c(T, S)(S s, in T left =          S.stringof~"(" , in T right = ")") {}  // combination with enh 13944

// from std.range.package in 2.067a.
auto enumerate2803(En = size_t, R)(R r, En start = 0)
{
    // The type of 'start' should be size_t, it's the defaultArg of En,
    // rather than the deduced type from its defualtArg '0'.
    static assert(is(typeof(start) == size_t));
    return start;
}

// from std.numeric.
alias ElementType2803(R) = typeof(R.init[0].init);
void normalize2803(R)(R range, ElementType2803!R sum = 1)
{
    // The type of 'sum' should be determined to ElementType!(double[]) == double
    // before the type deduction from its defaultArg '1'.
    static assert(is(typeof(sum) == double));
}

auto foo14468(T)(T[]...) { return 1; }
auto foo14468(bool flag, T)(T[]...) { return 2; }

void test2803()
{
    assert(foo2803() == 0);
    assert(foo2803(1) == 1);

    S2803 s;
    assert(fun2803(1)    is &s2803);
    assert(fun2803(1, s) is &s);

    // regression cases

    toImpl2803a!string(1, "[");

    toImpl2803b! string(1);
    toImpl2803b!wstring(1);
    toImpl2803b!dstring(1);

    toImpl2803c! string(1);
    toImpl2803c!wstring(1); // requires enhancement 13944
    toImpl2803c!dstring(1); // requires enhancement 13944

    enumerate2803([1]);

    double[] a = [];
    normalize2803(a);

    assert(foo14468!int() == 1);
}

/**********************************/
// 6613

alias Tuple6613(T...) = T;

void f6613(T...)(int x = 0, T xs = Tuple6613!())
{
    assert(x == 0);
    static assert(T.length == 0);
}

void test6613()
{
    f6613();
}

/**********************************/
// 4953

void bug4953(T = void)(short x) {}
static assert(is(typeof(bug4953(3))));

/**********************************/
// 5886 & 5393

mixin template Foo5886(T)
{
    void foo(U : T, this X)() const { static assert(is(X == const K5886)); }
}

struct K5886
{
    void get1(this T)() const
    {
        pragma(msg, T);
    }
    void get2(int N=4, this T)() const
    {
        pragma(msg, N, " ; ", T);
    }

    mixin Foo5886!double;
    mixin Foo5886!string;

    void test() const
    {
        get1;       // OK
        get2;       // OK
        get2!8;     // NG

        foo!(int);
        foo!(typeof(null));
    }
}

void test5886()
{
    K5886 km;
    const(K5886) kc;
    immutable(K5886) ki;

    km.get1;        // OK
    kc.get1;        // OK
    ki.get1;        // OK
    km.get2;        // OK
    kc.get2;        // OK
    ki.get2;        // OK
    km.get2!(1, K5886);             // Ugly
    kc.get2!(2, const(K5886));      // Ugly
    ki.get2!(3, immutable(K5886));  // Ugly
    km.get2!8;      // Error
    kc.get2!9;      // Error
    ki.get2!10;     // Error
}

// --------

void test5393()
{
    class A
    {
        void opDispatch (string name, this T) () { }
    }

    class B : A {}

    auto b = new B;
    b.foobar();
}

/**********************************/
// 5896

struct X5896
{
                 T opCast(T)(){ return 1; }
           const T opCast(T)(){ return 2; }
       immutable T opCast(T)(){ return 3; }
          shared T opCast(T)(){ return 4; }
    const shared T opCast(T)(){ return 5; }
}
void test5896()
{
    auto xm =              X5896  ();
    auto xc =        const(X5896) ();
    auto xi =    immutable(X5896) ();
    auto xs =       shared(X5896) ();
    auto xcs= const(shared(X5896))();
    assert(cast(int)xm == 1);
    assert(cast(int)xc == 2);
    assert(cast(int)xi == 3);
    assert(cast(int)xs == 4);
    assert(cast(int)xcs== 5);
}

/**********************************/
// 6312

void h6312() {}

class Bla6312
{
    mixin wrap6312!h6312;
}

mixin template wrap6312(alias f)
{
    void blub(alias g = f)()
    {
        g();
    }
}

void test6312()
{
    Bla6312 b = new Bla6312();
    b.blub();
}

/**********************************/
// 6825

void test6825()
{
    struct File
    {
        void write(S...)(S args) {}
    }

    void dump(void delegate(string) d) {}

    auto o = File();
    dump(&o.write!string);
}

/**********************************/
// 6789

template isStaticArray6789(T)
{
    static if (is(T U : U[N], size_t N))    // doesn't match
    {
        pragma(msg, "> U = ", U, ", N:", typeof(N), " = ", N);
        enum isStaticArray6789 = true;
    }
    else
        enum isStaticArray6789 = false;
}

void test6789()
{
    alias int[3] T;
    static assert(isStaticArray6789!T);
}

/**********************************/
// 2778

struct ArrayWrapper2778(T)
{
    T[] data;
    alias data this;
}

void doStuffFunc2778(int[] data) {}

void doStuffTempl2778(T)(T[] data) {}

int doStuffTemplOver2778(T)(void* data) { return 1; }
int doStuffTemplOver2778(T)(ArrayWrapper2778!T w) { return 2; }

void test2778()
{
    ArrayWrapper2778!(int) foo;

    doStuffFunc2778(foo);  // Works.

    doStuffTempl2778!(int)(foo);  // Works.

    doStuffTempl2778(foo);  // Error

    assert(doStuffTemplOver2778(foo) == 2);
}

// ----

void test2778aa()
{
    void foo(K, V)(V[K] aa){ pragma(msg, "K=", K, ", V=", V); }

    int[string] aa1;
    foo(aa1);   // OK

    struct SubTypeOf(T)
    {
        T val;
        alias val this;
    }
    SubTypeOf!(string[char]) aa2;
    foo(aa2);   // NG
}

// ----

void test2778get()
{
    void foo(ubyte[]){}

    static struct S
    {
        ubyte[] val = [1,2,3];
        @property ref ubyte[] get(){ return val; }
        alias get this;
    }
    S s;
    foo(s);
}

/**********************************/
// 6208

int getRefNonref(T)(ref T s){ return 1; }
int getRefNonref(T)(    T s){ return 2; }

int getAutoRef(T)(auto ref T s){ return __traits(isRef, s) ? 1 : 2; }

void getOut(T)(out T s){ {} }

void getLazy1(T=int)(lazy void s){ s(), s(); }
void getLazy2(T)(lazy T s){  s(), s(); }

void test6208a()
{
    int lvalue;
    int rvalue(){ int t; return t; }

    assert(getRefNonref(lvalue  ) == 1);
    assert(getRefNonref(rvalue()) == 2);

    assert(getAutoRef(lvalue  ) == 1);
    assert(getAutoRef(rvalue()) == 2);

    static assert( __traits(compiles, getOut(lvalue  )));
    static assert(!__traits(compiles, getOut(rvalue())));

    int n1; getLazy1(++n1); assert(n1 == 2);
    int n2; getLazy2(++n2); assert(n2 == 2);

    struct X
    {
        int f(T)(auto ref T t){ return 1; }
        int f(T)(auto ref T t, ...){ return -1; }
    }
    auto xm =       X ();
    auto xc = const(X)();
    int n;
    assert(xm.f!int(n) == 1);   // resolved 'auto ref'
    assert(xm.f!int(0) == 1);   // ditto
}

void test6208b()
{
    void foo(T)(const T value) if (!is(T == int)) {}

    int mn;
    const int cn;
    static assert(!__traits(compiles, foo(mn)));    // OK -> OK
    static assert(!__traits(compiles, foo(cn)));    // NG -> OK
}

void test6208c()
{
    struct S
    {
        // Original test case.
        int foo(V)(in V v)                         { return 1; }
        int foo(Args...)(auto ref const Args args) { return 2; }

        // Reduced test cases

        int hoo(V)(const V v)             { return 1; }  // typeof(10) : const V       -> MATCHconst
        int hoo(Args...)(const Args args) { return 2; }  // typeof(10) : const Args[0] -> MATCHconst
        // If deduction matching level is same, tuple parameter is less specialized than others.

        int bar(V)(V v)                   { return 1; }  // typeof(10) : V             -> MATCHexact
        int bar(Args...)(const Args args) { return 2; }  // typeof(10) : const Args[0] -> MATCHconst

        int baz(V)(const V v)             { return 1; }  // typeof(10) : const V -> MATCHconst
        int baz(Args...)(Args args)       { return 2; }  // typeof(10) : Args[0] -> MATCHexact

        inout(int) war(V)(inout V v)            { return 1; }
        inout(int) war(Args...)(inout Args args){ return 2; }

        inout(int) waz(Args...)(inout Args args){ return 0; }   // wild deduction test
    }

    S s;

    int nm = 10;
    assert(s.foo(nm) == 1);
    assert(s.hoo(nm) == 1);
    assert(s.bar(nm) == 1);
    assert(s.baz(nm) == 2);
    assert(s.war(nm) == 1);
    static assert(is(typeof(s.waz(nm)) == int));

    const int nc = 10;
    assert(s.foo(nc) == 1);
    assert(s.hoo(nc) == 1);
    assert(s.bar(nc) == 1);
    assert(s.baz(nc) == 1);
    assert(s.war(nc) == 1);
    static assert(is(typeof(s.waz(nc)) == const(int)));

    immutable int ni = 10;
    assert(s.foo(ni) == 1);
    assert(s.hoo(ni) == 1);
    assert(s.bar(ni) == 1);
    assert(s.baz(ni) == 2);
    assert(s.war(ni) == 1);
    static assert(is(typeof(s.waz(ni)) == immutable(int)));

    static assert(is(typeof(s.waz(nm, nm)) == int));
    static assert(is(typeof(s.waz(nm, nc)) == const(int)));
    static assert(is(typeof(s.waz(nm, ni)) == const(int)));
    static assert(is(typeof(s.waz(nc, nm)) == const(int)));
    static assert(is(typeof(s.waz(nc, nc)) == const(int)));
    static assert(is(typeof(s.waz(nc, ni)) == const(int)));
    static assert(is(typeof(s.waz(ni, nm)) == const(int)));
    static assert(is(typeof(s.waz(ni, nc)) == const(int)));
    static assert(is(typeof(s.waz(ni, ni)) == immutable(int)));
}

/**********************************/
// 6805

struct T6805
{
    template opDispatch(string name)
    {
        alias int Type;
    }
}
static assert(is(T6805.xxx.Type == int));

/**********************************/
// 6738

struct Foo6738
{
    int _val = 10;

    @property int val()() { return _val; }
    int get() { return val; }  // fail
}

void test6738()
{
    Foo6738 foo;
    auto x = foo.val;  // ok
    assert(x == 10);
    assert(foo.get() == 10);
}

/**********************************/
// 7498

template IndexMixin(){
    void insert(T)(T value){  }
}

class MultiIndexContainer{
    mixin IndexMixin!() index0;
    class Index0{
        void baburk(){
            this.outer.index0.insert(1);
        }
    }
}

/**********************************/
// 6780

@property int foo6780()(){ return 10; }

int g6780;
@property void bar6780()(int n){ g6780 = n; }

void test6780()
{
    auto n = foo6780;
    assert(n == 10);

    bar6780 = 10;
    assert(g6780 == 10);
}

/**********************************/
// 6810

int f6810(int n)(int) { return 1;}
int f6810(U...)(U)    { assert(0); }
int f6810(U...)(U a)  { assert(0); }
int f6810(U...)(U)   if (true) { assert(0); }
int f6810(U...)(U a) if (true) { assert(0); }

void test6810()
{
    assert(f6810!0(0) == 1);
}

/**********************************/
// 6891

struct S6891(int N, T)
{
    void f(U)(S6891!(N, U) u) { }
}

void test6891()
{
    alias S6891!(1, void) A;
    A().f(A());
}

/**********************************/
// 6994

struct Foo6994
{
    T get(T)(){ return T.init; }

    T func1(T)()
    if (__traits(compiles, get!T()))
    { return get!T; }

    T func2(T)()
    if (__traits(compiles, this.get!T()))   // add explicit 'this'
    { return get!T; }
}
void test6994()
{
    Foo6994 foo;
    foo.get!int();      // OK
    foo.func1!int();    // OK
    foo.func2!int();    // NG
}

/**********************************/
// 6764

enum N6764 = 1; //use const for D1

alias size_t[N6764] T6764; //workaround
void f6764()(T6764 arr...) { }

void g6764()(size_t[1] arr...) { }

void h6764()(size_t[N6764] arr...) { }

void test6764()
{
    f6764(0);    //good
    g6764(0);    //good
    h6764!()(0); //good
    h6764(0);    //Error: template main.f() does not match any function template declaration
}

/**********************************/
// 3467 & 6806

struct Foo3467( uint n )
{
    Foo3467!( n ) bar( ) {
        typeof( return ) result;
        return result;
    }
}
struct Vec3467(size_t N)
{
    void opBinary(string op:"~", size_t M)(Vec3467!M) {}
}
void test3467()
{
    Foo3467!( 4 ) baz;
    baz = baz.bar;// FAIL

    Vec3467!2 a1;
    Vec3467!3 a2;
    a1 ~ a2; // line 7, Error
}

struct TS6806(size_t n) { pragma(msg, typeof(n)); }
static assert(is(TS6806!(1u) == TS6806!(1)));

/**********************************/
// 4413

struct Foo4413
{
    alias typeof(this) typeof_this;
    void bar1(typeof_this other) {}
    void bar2()(typeof_this other) {}
    void bar3(typeof(this) other) {}
    void bar4()(typeof(this) other) {}
}

void test4413()
{
    Foo4413 f;
    f.bar1(f); // OK
    f.bar2(f); // OK
    f.bar3(f); // OK
    f.bar4(f); // ERR
}

/**********************************/
// 4675

template isNumeric(T)
{
    enum bool test1 = is(T : long);     // should be hidden
    enum bool test2 = is(T : real);     // should be hidden
    enum bool isNumeric = test1 || test2;
}
void test4675()
{
    static assert( isNumeric!int);
    static assert(!isNumeric!string);
    static assert(!__traits(compiles, isNumeric!int.test1));   // should be an error
    static assert(!__traits(compiles, isNumeric!int.test2));   // should be an error
    static assert(!__traits(compiles, isNumeric!int.isNumeric));
}

/**********************************/
// 5525

template foo5525(T)
{
    T foo5525(T t)      { return t; }
    T foo5525(T t, T u) { return t + u; }
}

void test5525()
{
    alias foo5525!int f;
    assert(f(1) == 1);
    assert(f(1, 2) == 3);
}

/**********************************/
// 5801

int a5801;
void bar5801(T = double)(typeof(a5801) i) {}
void baz5801(T)(typeof(a5801) i, T t) {}
void test5801()
{
    bar5801(2);  // Does not compile.
    baz5801(3, "baz"); // Does not compile.
}

/**********************************/
// 5832

struct Bar5832(alias v) {}

template isBar5832a(T)
{
    static if (is(T _ : Bar5832!(v), alias v))
        enum isBar5832a = true;
    else
        enum isBar5832a = false;
}
template isBar5832b(T)
{
    static if (is(T _ : Bar5832!(v), alias int v))
        enum isBar5832b = true;
    else
        enum isBar5832b = false;
}
template isBar5832c(T)
{
    static if (is(T _ : Bar5832!(v), alias string v))
        enum isBar5832c = true;
    else
        enum isBar5832c = false;
}
static assert( isBar5832a!(Bar5832!1234));
static assert( isBar5832b!(Bar5832!1234));
static assert(!isBar5832c!(Bar5832!1234));

/**********************************/
// 2550

template pow10_2550(long n)
{
    const long pow10_2550 = 0;
    static if (n < 0)
        const long pow10_2550 = 0;
    else
        const long pow10_2550 = 10 * pow10_2550!(n - 1);
}
template pow10_2550(long n:0)
{
    const long pow10_2550 = 1;
}
static assert(pow10_2550!(0) == 1);

/**********************************/
// [2.057] Remove top const in IFTI, 9198

void foo10a(T   )(T)            { static assert(is(T    == const(int)[])); }
void foo10b(T...)(T)            { static assert(is(T[0] == const(int)[])); }

// ref parameter doesn't remove top const
void boo10a(T   )(ref T)        { static assert(is(T    == const(int[]))); }
void boo10b(T...)(ref T)        { static assert(is(T[0] == const(int[]))); }

// auto ref with lvalue doesn't
void goo10a(T   )(auto ref T)   { static assert(is(T    == const(int[]))); }
void goo10b(T...)(auto ref T)   { static assert(is(T[0] == const(int[]))); }

// auto ref with rvalue does
void hoo10a(T   )(auto ref T)   { static assert(is(T    == const(int)[])); }
void hoo10b(T...)(auto ref T)   { static assert(is(T[0] == const(int)[])); }

void bar10a(T   )(T)            { static assert(is(T    == const(int)*)); }
void bar10b(T...)(T)            { static assert(is(T[0] == const(int)*)); }

void test10()
{
    const a = [1,2,3];
    static assert(is(typeof(a) == const(int[])));
    foo10a(a);
    foo10b(a);
    boo10a(a);
    boo10b(a);
    goo10a(a);
    goo10b(a);
    hoo10a(cast(const)[1,2,3]);
    hoo10b(cast(const)[1,2,3]);

    int n;
    const p = &n;
    static assert(is(typeof(p) == const(int*)));
    bar10a(p);
    bar10b(p);
}

/**********************************/
// 3092

template Foo3092(A...)
{
    alias A[0] Foo3092;
}
static assert(is(Foo3092!(int, "foo") == int));

/**********************************/
// 7037

struct Foo7037 {}
struct Bar7037 { Foo7037 f; alias f this; }
void works7037( T )( T value ) if ( is( T : Foo7037 ) ) {}
void doesnotwork7037( T : Foo7037 )( T value ) {}

void test7037()
{
   Bar7037 b;
   works7037( b );
   doesnotwork7037( b );
}

/**********************************/
// 7110

struct S7110
{
    int opSlice(int, int) const { return 0; }
    int opSlice()         const { return 0; }
    int opIndex(int, int) const { return 0; }
    int opIndex(int)      const { return 0; }
}

enum e7110 = S7110();

template T7110(alias a) { } // or T7110(a...)

alias T7110!( S7110 ) T71100; // passes
alias T7110!((S7110)) T71101; // passes

alias T7110!( S7110()[0..0]  )  A0; // passes
alias T7110!(  (e7110[0..0]) )  A1; // passes
alias T7110!(   e7110[0..0]  )  A2; // passes

alias T7110!( S7110()[0, 0]  ) B0; // passes
alias T7110!(  (e7110[0, 0]) ) B1; // passes
alias T7110!(   e7110[0, 0]  ) B2; // passes

alias T7110!( S7110()[]  ) C0; // passes
alias T7110!(  (e7110[]) ) C1; // passes
alias T7110!(   e7110[]  ) C2; // fails: e7110 is used as a type

alias T7110!( S7110()[0]  ) D0; // passes
alias T7110!(  (e7110[0]) ) D1; // passes
alias T7110!(   e7110[0]  ) D2; // fails: e7110 must be an array or pointer type, not S7110

/**********************************/
// 7124

template StaticArrayOf(T : E[dim], E, size_t dim)
{
    pragma(msg, "T = ", T, ", E = ", E, ", dim = ", dim);
    alias E[dim] StaticArrayOf;
}

template DynamicArrayOf(T : E[], E)
{
    pragma(msg, "T = ", T, ", E = ", E);
    alias E[] DynamicArrayOf;
}

template AssocArrayOf(T : V[K], K, V)
{
    pragma(msg, "T = ", T, ", K = ", K, ", V = ", V);
    alias V[K] AssocArrayOf;
}
void test7124()
{
    struct SA { int[5] sa; alias sa this; }
    static assert(is(StaticArrayOf!SA == int[5]));

    struct DA { int[] da; alias da this; }
    static assert(is(DynamicArrayOf!DA == int[]));

    struct AA { int[string] aa; alias aa this; }
    static assert(is(AssocArrayOf!AA == int[string]));
}

/**********************************/
// 7359

bool foo7359(T)(T[] a ...)
{
    return true;
}

void test7359()
{
    assert(foo7359(1,1,1,1,1,1));               // OK
    assert(foo7359("abc","abc","abc","abc"));   // NG
}

/**********************************/
// 7363

template t7363()
{
   enum e = 0;
   static if (true)
       enum t7363 = 0;
}
static assert(!__traits(compiles, t7363!().t7363 == 0)); // Assertion fails
static assert(t7363!() == 0); // Error: void has no value

template u7363()
{
   static if (true)
   {
       enum e = 0;
       enum u73631 = 0;
   }
   alias u73631 u7363;
}
static assert(!__traits(compiles, u7363!().u7363 == 0)); // Assertion fails
static assert(u7363!() == 0); // Error: void has no value

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

struct S4371(T ...) { }

alias S4371!("hi!") t;

static if (is(t U == S4371!(U))) { }

/**********************************/
// 7416

void t7416(alias a)() if(is(typeof(a())))
{}

void test7416() {
    void f() {}
    alias t7416!f x;
}

/**********************************/
// 7563

class Test7563
{
    void test(T, bool a = true)(T t)
    {

    }
}

void test7563()
{
    auto test = new Test7563;
    pragma(msg, typeof(test.test!(int, true)).stringof);
    pragma(msg, typeof(test.test!(int)).stringof); // Error: expression (test.test!(int)) has no type
}

/**********************************/
// 7572

class F7572
{
    Tr fn7572(Tr, T...)(T t) { return 1; }
}
Tr Fn7572(Tr, T...)(T t) { return 2; }

void test7572()
{
    F7572 f = new F7572();
    int delegate() dg = &f.fn7572!int;
    assert(dg() == 1);

    int function() fn = &Fn7572!int;
    assert(fn() == 2);
}

/**********************************/
// 7580

struct S7580(T)
{
    void opAssign()(T value) {}
}
struct X7580(T)
{
    private T val;
    @property ref inout(T) get()() inout { return val; }    // template
    alias get this;
}
struct Y7580(T)
{
    private T val;
    @property ref auto get()() inout { return val; }        // template + auto return
    alias get this;
}

void test7580()
{
    S7580!(int) s;
    X7580!int x;
    Y7580!int y;
    s = x;
    s = y;

    shared(X7580!int) sx;
    static assert(!__traits(compiles, s = sx));
}

/**********************************/
// 7585

extern(C) alias void function() Callback;

template W7585a(alias dg)
{
    //pragma(msg, typeof(dg));
    extern(C) void W7585a() { dg(); }
}

void test7585()
{
    static void f7585a(){}
    Callback cb1 = &W7585a!(f7585a);      // OK
    static assert(!__traits(compiles,
    {
        void f7585b(){}
        Callback cb2 = &W7585a!(f7585b);  // NG
    }));

    Callback cb3 = &W7585a!((){});              // NG -> OK
    Callback cb4 = &W7585a!(function(){});      // OK
    static assert(!__traits(compiles,
    {
        Callback cb5 = &W7585a!(delegate(){});  // NG
    }));

    static int global;  // global data
    Callback cb6 = &W7585a!((){return global;});    // NG -> OK
    static assert(!__traits(compiles,
    {
        int n;
        Callback cb7 = &W7585a!((){return n;});     // NG
    }));
}

/**********************************/
// 7643

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

alias T7643!(long, "x", string, "y") Specs7643;

alias T7643!( Specs7643[] ) U7643;  // Error: tuple A is used as a type

/**********************************/
// 7671

       inout(int)[3]  id7671n1             ( inout(int)[3] );
       inout( U )[n]  id7671x1(U, size_t n)( inout( U )[n] );

shared(inout int)[3]  id7671n2             ( shared(inout int)[3] );
shared(inout  U )[n]  id7671x2(U, size_t n)( shared(inout  U )[n] );

void test7671()
{
    static assert(is( typeof( id7671n1( (immutable(int)[3]).init ) ) == immutable(int[3]) ));
    static assert(is( typeof( id7671x1( (immutable(int)[3]).init ) ) == immutable(int[3]) ));

    static assert(is( typeof( id7671n2( (immutable(int)[3]).init ) ) == immutable(int[3]) ));
    static assert(is( typeof( id7671x2( (immutable(int)[3]).init ) ) == immutable(int[3]) ));
}

/************************************/
// 7672

T foo7672(T)(T a){ return a; }

void test7672(inout(int[]) a = null, inout(int*) p = null)
{
    static assert(is( typeof(        a ) == inout(int[]) ));
    static assert(is( typeof(foo7672(a)) == inout(int)[] ));

    static assert(is( typeof(        p ) == inout(int*) ));
    static assert(is( typeof(foo7672(p)) == inout(int)* ));
}

/**********************************/
// 7684

       U[]  id7684(U)(        U[]  );
shared(U[]) id7684(U)( shared(U[]) );

void test7684()
{
    shared(int)[] x;
    static assert(is( typeof(id7684(x)) == shared(int)[] ));
}

/**********************************/
// 7694

void match7694(alias m)()
{
    m.foo();    //removing this line suppresses ice in both cases
}

struct T7694
{
    void foo(){}
    void bootstrap()
    {
    //next line causes ice
        match7694!(this)();
    //while this works:
        alias this p;
        match7694!(p)();
    }
}

/**********************************/
// 7755

template to7755(T)
{
    T to7755(A...)(A args)
    {
        return toImpl7755!T(args);
    }
}

T toImpl7755(T, S)(S value)
{
    return T.init;
}

template Foo7755(T){}

struct Bar7755
{
    void qux()
    {
        if (is(typeof(to7755!string(Foo7755!int)))){}
    }
}

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

             U[]   id11a(U)(              U[]   );
       inout(U)[]  id11a(U)(        inout(U)[]  );
       inout(U[])  id11a(U)(        inout(U[])  );
inout(shared(U[])) id11a(U)( inout(shared(U[])) );

void test11a(inout int _ = 0)
{
    shared(const(int))[] x;
    static assert(is( typeof(id11a(x)) == shared(const(int))[] ));

    shared(int)[] y;
    static assert(is( typeof(id11a(y)) == shared(int)[] ));

    inout(U)[n] idz(U, size_t n)( inout(U)[n] );

    inout(shared(bool[1])) z;
    static assert(is( typeof(idz(z)) == inout(shared(bool[1])) ));
}

inout(U[]) id11b(U)( inout(U[]) );

void test11b()
{
    alias const(shared(int)[]) T;
    static assert(is(typeof(id11b(T.init)) == const(shared(int)[])));
}

/**********************************/
// 7769

void f7769(K)(inout(K) value){}
void test7769()
{
    f7769("abc");
}

/**********************************/
// 7812

template A7812(T...) {}

template B7812(alias C) if (C) {}

template D7812()
{
    alias B7812!(A7812!(NonExistent!())) D7812;
}

static assert(!__traits(compiles, D7812!()));

/**********************************/
// 7873

inout(T)* foo(T)(inout(T)* t)
{
    static assert(is(T == int*));
    return t;
}

inout(T)* bar(T)(inout(T)* t)
{
    return foo(t);
}

void test7873()
{
    int *i;
    bar(&i);
}

/**********************************/
// 7933

struct Boo7933(size_t dim){int a;}
struct Baa7933(size_t dim)
{
    Boo7933!dim a;
    //Boo7933!1 a; //(1) This version causes no errors
}

auto foo7933()(Boo7933!1 b){return b;}
//auto fuu7933(Boo7933!1 b){return b;} //(2) This line neutralizes the error

void test7933()
{
    Baa7933!1 a; //(3) This line causes the error message
    auto b = foo7933(Boo7933!1(1));
}

/**********************************/
// 8094

struct Tuple8094(T...) {}

template getParameters8094(T, alias P)
{
    static if (is(T t == P!U, U...))
        alias U getParameters8094;
    else
        static assert(false);
}

void test8094()
{
    alias getParameters8094!(Tuple8094!(int, string), Tuple8094) args;
}

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

struct Tuple12(T...)
{
    void foo(alias P)()
    {
        alias Tuple12 X;
        static if (is(typeof(this) t == X!U, U...))
            alias U getParameters;
        else
            static assert(false);
    }
}

void test12()
{
    Tuple12!(int, string) t;
    t.foo!Tuple12();
}

/**********************************/
// 14290

struct Foo14290(int i) {}
alias Foo14290a = Foo14290!1;
static assert(!is(Foo14290!2 == Foo14290a!T, T...));

/**********************************/
// 8125

void foo8125(){}

struct X8125(alias a) {}

template Y8125a(T : A!f, alias A, alias f) {}  //OK
template Y8125b(T : A!foo8125, alias A) {}     //NG

void test8125()
{
    alias Y8125a!(X8125!foo8125) y1;
    alias Y8125b!(X8125!foo8125) y2;
}

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

struct A13() {}
struct B13(TT...) {}
struct C13(T1) {}
struct D13(T1, TT...) {}
struct E13(T1, T2) {}
struct F13(T1, T2, TT...) {}

template Test13(alias X)
{
    static if (is(X x : P!U, alias P, U...))
        enum Test13 = true;
    else
        enum Test13 = false;
}

void test13()
{
    static assert(Test13!( A13!() ));
    static assert(Test13!( B13!(int) ));
    static assert(Test13!( B13!(int, double) ));
    static assert(Test13!( B13!(int, double, string) ));
    static assert(Test13!( C13!(int) ));
    static assert(Test13!( D13!(int) ));
    static assert(Test13!( D13!(int, double) ));
    static assert(Test13!( D13!(int, double, string) ));
    static assert(Test13!( E13!(int, double) ));
    static assert(Test13!( F13!(int, double) ));
    static assert(Test13!( F13!(int, double, string) ));
    static assert(Test13!( F13!(int, double, string, bool) ));
}

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

struct A14(T, U, int n = 1)
{
}

template Test14(alias X)
{
    static if (is(X x : P!U, alias P, U...))
        alias U Test14;
    else
        static assert(0);
}

void test14()
{
    alias A14!(int, double) Type;
    alias Test14!Type Params;
    static assert(Params.length == 3);
    static assert(is(Params[0] == int));
    static assert(is(Params[1] == double));
    static assert(   Params[2] == 1);
}

/**********************************/
// test for evaluateConstraint assertion

bool canSearchInCodeUnits15(C)(dchar c)
if (is(C == char))
{
    return true;
}

void test15()
{
    int needle = 0;
    auto b = canSearchInCodeUnits15!char(needle);
}

/**********************************/
// 8129

class X8129 {}
class A8129 {}
class B8129 : A8129 {}

int foo8129(T : A8129)(X8129 x) { return 1; }
int foo8129(T : A8129)(X8129 x, void function (T) block) { return 2; }

int bar8129(T, R)(R range, T value) { return 1; }

int baz8129(T, R)(R range, T value) { return 1; }
int baz8129(T, R)(R range, Undefined value) { return 2; }

void test8129()
{
    auto x = new X8129;
    assert(x.foo8129!B8129()      == 1);
    assert(x.foo8129!B8129((a){}) == 2);
    assert(foo8129!B8129(x)        == 1);
    assert(foo8129!B8129(x, (a){}) == 2);
    assert(foo8129!B8129(x)              == 1);
    assert(foo8129!B8129(x, (B8129 b){}) == 2);

    ubyte[] buffer = [0, 1, 2];
    assert(bar8129!ushort(buffer, 915) == 1);

    // While deduction, parameter type 'Undefined' shows semantic error.
    static assert(!__traits(compiles, {
        baz8129!ushort(buffer, 915);
    }));
}

/**********************************/
// 8238

void test8238()
{
    static struct S { template t(){ int t; } }

    S s1, s2;
    assert(cast(void*)&s1      != cast(void*)&s2     );
    assert(cast(void*)&s1      != cast(void*)&s1.t!());
    assert(cast(void*)&s2      != cast(void*)&s2.t!());
    assert(cast(void*)&s1.t!() == cast(void*)&s2.t!());
    s1.t!() = 256;
    assert(s2.t!() == 256);
}

/**********************************/
// 8669

struct X8669
{
    void mfoo(this T)()
    {
        static assert(is(typeof(this) == T));
    }
    void cfoo(this T)() const
    {
        static assert(is(typeof(this) == const(T)));
    }
    void sfoo(this T)() shared
    {
        static assert(is(typeof(this) == shared(T)));
    }
    void scfoo(this T)() shared const
    {
        static assert(is(typeof(this) == shared(const(T))));
    }
    void ifoo(this T)() immutable
    {
        static assert(is(typeof(this) == immutable(T)));
    }
}

void test8669()
{
                 X8669 mx;
           const X8669 cx;
      immutable  X8669 ix;
          shared X8669 sx;
    shared const X8669 scx;

     mx.mfoo();
     cx.mfoo();
     ix.mfoo();
     sx.mfoo();
    scx.mfoo();

     mx.cfoo();
     cx.cfoo();
     ix.cfoo();
     sx.cfoo();
    scx.cfoo();

    static assert(!is(typeof(  mx.sfoo() )));
    static assert(!is(typeof(  cx.sfoo() )));
     ix.sfoo();
     sx.sfoo();
    scx.sfoo();

    static assert(!is(typeof(  mx.scfoo() )));
    static assert(!is(typeof(  cx.scfoo() )));
     ix.scfoo();
     sx.scfoo();
    scx.scfoo();

    static assert(!is(typeof(  mx.ifoo() )));
    static assert(!is(typeof(  cx.ifoo() )));
     ix.ifoo();
    static assert(!is(typeof(  sx.ifoo() )));
    static assert(!is(typeof( scx.ifoo() )));
}

/**********************************/
// 8833

template TypeTuple8833(T...) { alias TypeTuple = T; }

void func8833(alias arg)() { }

void test8833()
{
    int x, y;

    alias TypeTuple8833!(
        func8833!(x),
        func8833!(y),
    ) Map;
}

/**********************************/
// 8976

void f8976(ref int) { }

void g8976()()
{
    f8976(0); // line 5
}


void h8976()()
{
    g8976!()();
}

static assert(! __traits(compiles, h8976!()() ) ); // causes error
static assert(!is(typeof(          h8976!()() )));

void test8976()
{
    static assert(! __traits(compiles, h8976!()() ) );
    static assert(!is(typeof(          h8976!()() )));
}

/****************************************/
// 8940

const int n8940; // or `immutable`
static this() { n8940 = 3; }

void f8940(T)(ref int val)
{
    assert(val == 3);
    ++val;
}

static assert(!__traits(compiles,  f8940!void(n8940))); // fails
void test8940()
{
    assert(n8940 == 3);
    static assert(!__traits(compiles, f8940!void(n8940)));
    //assert(n8940 == 3); // may pass as compiler caches comparison result
    //assert(n8940 != 4); // may pass but likely will fail
}

/**********************************/
// 6969 + 8990

class A6969() { alias C6969!() C1; }
class B6969   { alias A6969!() A1; }
class C6969() : B6969 {}

struct A8990(T) { T t; }
struct B8990(T) { A8990!T* a; }
struct C8990    { B8990!C8990* b; }

/**********************************/
// 9018

template Inst9018(alias Template, T)
{
    alias Template!T Inst;
}

template Template9018(T)
{
    enum Template9018 = T;
}

static assert(!__traits(compiles, Inst9018!(Template9018, int))); // Assert passes
static assert(!__traits(compiles, Inst9018!(Template9018, int))); // Assert fails

/**********************************/
// 9022

class C9022
{
    struct X {}

    alias B = X;
}
class D9022
{
    struct X {}
}

void test9022()
{
    auto c = new C9022();
    auto d = new D9022();
    auto cx = C9022.X();
    auto dx = D9022.X();

    void foo1(T)(T, T.X) { static assert(is(T == C9022)); }
    void foo2(T)(T.X, T) { static assert(is(T == C9022)); }
    foo1(c, cx);
    foo2(cx, c);

    void hoo1(T)(T, T.B) { static assert(is(T == C9022)); }
    void hoo2(T)(T.B, T) { static assert(is(T == C9022)); }
    hoo1(c, cx);
    hoo1(c, cx);

    void bar1(alias A)(A.C9022, A.D9022) { static assert(A.stringof == "module breaker"); }
    void bar2(alias A)(A.D9022, A.C9022) { static assert(A.stringof == "module breaker"); }
    bar1(c, d);
    bar2(d, c);

    void var1(alias A)(A.C9022, A.D9022.X) { static assert(A.stringof == "module breaker"); }
    void var2(alias A)(A.D9022.X, A.C9022) { static assert(A.stringof == "module breaker"); }
    var1(c, dx);
    var2(dx, c);

    void baz(T)(T.X t, T.X u) { }
    static assert(!__traits(compiles, baz(cx, dx)));
}

/**********************************/
// 9026

mixin template node9026()
{
    static if (is(this == struct))
        alias typeof(this)* E;
    else
        alias typeof(this) E;
    E prev, next;
}

struct list9026(alias N)
{
    N.E head;
    N.E tail;
}

class A9026
{
    mixin node9026 L1;
    mixin node9026 L2;
}

list9026!(A9026.L1) g9026_l1;
list9026!(A9026.L2) g9026_l2;

void test9026()
{
    list9026!(A9026.L1) l9026_l1;
    list9026!(A9026.L2) l9026_l2;
}

/**********************************/
// 9038

mixin template Foo9038()
{
    string data = "default";
}

class Bar9038
{
    string data;
    mixin Foo9038 f;
}

void check_data9038(alias M, T)(T obj)
{
    //writeln(M.stringof);
    assert(obj.data == "Bar");
    assert(obj.f.data == "F");
}

void test9038()
{
    auto bar = new Bar9038;
    bar.data = "Bar";
    bar.f.data = "F";

    assert(bar.data == "Bar");
    assert(bar.f.data == "F");

    check_data9038!(Bar9038)(bar);
    check_data9038!(Bar9038.f)(bar);
    check_data9038!(bar.f)(bar);
}

/**********************************/
// 9050

struct A9050(T) {}

struct B9050(T)
{
    void f() { foo9050(A9050!int()); }
}

auto foo9050()(A9050!int base) pure
{
    return B9050!int();
}

auto s9050 = foo9050(A9050!int());

/**********************************/
// 10936 (dup of 9050)

struct Vec10936(string s)
{
    auto foo(string v)()
    {
        return Vec10936!(v)();
    }

    static void bar()
    {
        Vec10936!"" v;
        auto p = v.foo!"sup";
    }
}

Vec10936!"" v;

/**********************************/
// 9076

template forward9076(args...)
{
    @property forward9076()(){ return args[0]; }
}

void test9076()
{
    int a = 1;
    int b = 1;
    assert(a == forward9076!b);
}

/**********************************/
// 9083

template isFunction9083(X...) if (X.length == 1)
{
    enum isFunction9083 = true;
}

struct S9083
{
    static string func(alias Class)()
    {
        foreach (m; __traits(allMembers, Class))
        {
            pragma(msg, m);  // prints "func"
            enum x1 = isFunction9083!(mixin(m));  //NG
            enum x2 = isFunction9083!(func);      //OK
        }
        return "";
    }
}
enum nothing9083 = S9083.func!S9083();

class C9083
{
    int x;  // some class members

    void func()
    {
        void templateFunc(T)(const T obj)
        {
            enum x1 = isFunction9083!(mixin("x"));  // NG
            enum x2 = isFunction9083!(x);           // NG
        }
        templateFunc(this);
    }
}

/**********************************/
// 9100

template Id(alias A) { alias Id = A; }
template ErrId(alias A) { static assert(0); }
template TypeTuple9100(TL...) { alias TypeTuple9100 = TL; }

class C9100
{
    int value;

    int fun() { return value; }
    int tfun(T)() { return value; }
    TypeTuple9100!(int, long) field;

    void test()
    {
        this.value = 1;
        auto c = new C9100();
        c.value = 2;

        alias t1a = Id!(c.fun);             // OK
        alias t1b = Id!(this.fun);          // Prints weird error, bad
        // -> internally given TOKdotvar
        assert(t1a() == this.value);
        assert(t1b() == this.value);

        alias t2a = Id!(c.tfun);            // OK
        static assert(!__traits(compiles, ErrId!(this.tfun)));
        alias t2b = Id!(this.tfun);         // No error occurs, why?
        // -> internally given TOKdottd
        assert(t2a!int() == this.value);
        assert(t2b!int() == this.value);

        alias t3a = Id!(foo9100);           // OK
        alias t3b = Id!(mixin("foo9100"));  // Prints weird error, bad
        // -> internally given TOKtemplate
        assert(t3a() == 10);
        assert(t3b() == 10);

        assert(field[0] == 0);
        alias t4a = TypeTuple9100!(field);              // NG
        alias t4b = TypeTuple9100!(GetField9100!());    // NG
        t4a[0] = 1; assert(field[0] == 1);
        t4b[0] = 2; assert(field[0] == 2);
    }
}

int foo9100()() { return 10; }
template GetField9100() { alias GetField9100 = C9100.field[0]; }

void test9100()
{
    (new C9100()).test();
}

/**********************************/
// 9101

class Node9101
{
    template ForwardCtorNoId()
    {
        this() {} // default constructor
        void foo() { 0 = 1; }    // wrong code
    }
}
enum x9101 = __traits(compiles, Node9101.ForwardCtorNoId!());

/**********************************/
// 9124

struct Foo9124a(N...)
{
    enum SIZE = N[0];
    private int _val;

    public void opAssign (T) (T other)
    if (is(T unused == Foo9124a!(_N), _N...))
    {
        _val = other._val;          // compile error
        this._val = other._val;     // explicit this make it work
    }

    public auto opUnary (string op) () if (op == "~") {
        Foo9124a!(SIZE) result = this;
        return result;
    }
}
void test9124a()
{
    Foo9124a!(28) a;
    Foo9124a!(28) b = ~a;
}

// --------

template Foo9124b(T, U, string OP)
{
    enum N = T.SIZE;
    alias Foo9124b = Foo9124b!(false, true, N);
}
struct Foo9124b(bool S, bool L, N...)
{
    enum SIZE = 5;
    long[1] _a = 0;
    void someFunction() const {
        auto data1 = _a;        // Does not compile
        auto data2 = this._a;   // <--- Compiles
    }
    auto opBinary(string op, T)(T) {
        Foo9124b!(typeof(this), T, op) test;
    }
}
void test9124b()
{
    auto p = Foo9124b!(false, false, 5)();
    auto q = Foo9124b!(false, false, 5)();
    p|q;
    p&q;
}

/**********************************/
// 9143

struct Foo9143a(bool S, bool L)
{
    auto noCall() {
        Foo9143a!(S, false) x1;         // compiles if this line commented
        static if(S) Foo9143a!(true,  false) x2;
        else         Foo9143a!(false, false) x2;
    }
    this(T)(T other)        // constructor
    if (is(T unused == Foo9143a!(P, Q), bool P, bool Q)) { }
}

struct Foo9143b(bool L, size_t N)
{
    void baaz0() {
        bar!(Foo9143b!(false, N))();    // line 7
        // -> move to before the baaz semantic
    }
    void baaz() {
        bar!(Foo9143b!(false, 2LU))();  // line 3
        bar!(Foo9143b!(true, 2LU))();   // line 4
        bar!(Foo9143b!(L, N))();        // line 5
        bar!(Foo9143b!(true, N))();     // line 6
        bar!(Foo9143b!(false, N))();    // line 7
    }
    void bar(T)()
    if (is(T unused == Foo9143b!(_L, _N), bool _L, size_t _N))
    {}
}

void test9143()
{
    Foo9143a!(false, true) k = Foo9143a!(false, false)();

    auto p = Foo9143b!(true, 2LU)();
}

/**********************************/
// 9266

template Foo9266(T...)
{
    T Foo9266;
}
struct Bar9266()
{
    alias Foo9266!int f;
}
void test9266()
{
    Bar9266!() a, b;
}

/**********************************/
// 9361

struct Unit9361(A)
{
    void butPleaseDontUseMe()()
    if (is(unitType9361!((this))))  // !
    {}

}
template isUnit9361(alias T) if ( is(T)) {}
template isUnit9361(alias T) if (!is(T)) {}

template unitType9361(alias T) if (isUnit9361!T) {}

void test9361()
{
    Unit9361!int u;
    static assert(!__traits(compiles, u.butPleaseDontUseMe())); // crashes
}

/**********************************/
// 9536

struct S9536
{
    static A foo(A)(A a)
    {
        return a * 2;
    }
    int bar() const
    {
        return foo(42);
    }
}

void test9536()
{
    S9536 s;
    assert(s.bar() == 84);
}

/**********************************/
// 9578

template t9578(alias f) { void tf()() { f(); } }

void g9578a(alias f)()  { f(); }        // Error -> OK
void g9578b(alias ti)() { ti.tf(); }    // Error -> OK

void test9578()
{
    int i = 0;
    int m() { return i; }

    g9578a!(t9578!m.tf)();
    g9578b!(t9578!m)();
}

/**********************************/
// 9596

int foo9596a(K, V)(inout(       V  [K])) { return 1; }
int foo9596a(K, V)(inout(shared(V) [K])) { return 2; }

int foo9596b(K, V)(inout(       V  [K])) { return 1; }
int foo9596b(K, V)(inout( const(V) [K])) { return 3; }

int foo9596c(K, V)(inout(shared(V) [K])) { return 2; }
int foo9596c(K, V)(inout( const(V) [K])) { return 3; }

int foo9596d(K, V)(inout(       V  [K])) { return 1; }
int foo9596d(K, V)(inout(shared(V) [K])) { return 2; }
int foo9596d(K, V)(inout( const(V) [K])) { return 3; }

int foo9596e(K, V)(inout(shared(V) [K])) { return 2; }
int foo9596e(K, V)(inout(       V  [K])) { return 1; }
int foo9596e(K, V)(inout( const(V) [K])) { return 3; }

void test9596()
{
    shared(int)[int] aa;
    static assert(!__traits(compiles, foo9596a(aa)));

    assert(foo9596b(aa) == 1);
    assert(foo9596c(aa) == 2);

    static assert(!__traits(compiles, foo9596d(aa)));
    static assert(!__traits(compiles, foo9596e(aa)));
}

/******************************************/
// 9806

struct S9806a(alias x)
{
    alias S9806a!0 N;
}
enum expr9806a = 0 * 0;
alias S9806a!expr9806a T9806a;

// --------

struct S9806b(alias x)
{
    template Next()
    {
        enum expr = x + 1;
        alias S9806b!expr Next;
    }
}
alias S9806b!1 One9806b;
alias S9806b!0.Next!() OneAgain9806b;

// --------

struct S9806c(x...)
{
    template Next()
    {
        enum expr = x[0] + 1;
        alias S9806c!expr Next;
    }
}
alias S9806c!1 One9806c;
alias S9806c!0.Next!() OneAgain9806c;

/******************************************/
// 9837

void test9837()
{
    enum DA : int[] { a = [1,2,3] }
    DA da;
    int[] bda = da;
    static assert(is(DA : int[]));
    void fda1(int[] a) {}
    void fda2(T)(T[] a) {}
    fda1(da);
    fda2(da);

    enum SA : int[3] { a = [1,2,3] }
    SA sa;
    int[3] bsa = sa;
    static assert(is(SA : int[3]));
    void fsa1(int[3] a) {}
    void fsa2(T)(T[3] a) {}
    void fsa3(size_t d)(int[d] a) {}
    void fsa4(T, size_t d)(T[d] a) {}
    fsa1(sa);
    fsa2(sa);
    fsa3(sa);
    fsa4(sa);

    enum AA : int[int] { a = null }
    AA aa;
    int[int] baa = aa;
    static assert(is(AA : int[int]));
    void faa1(int[int] a) {}
    void faa2(V)(V[int] a) {}
    void faa3(K)(int[K] a) {}
    void faa4(K, V)(V[K] a) {}
    faa1(aa);
    faa2(aa);
    faa3(aa);
    faa4(aa);
}

/******************************************/
// 9874

bool foo9874() { return true; }
void bar9874(T)(T) if (foo9874()) {} // OK
void baz9874(T)(T) if (foo9874)   {} // error

void test9874()
{
    foo9874;                      // OK
    bar9874(0);
    baz9874(0);
}

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

void test9885()
{
    void foo(int[1][]) {}
    void boo()(int[1][]){}
    struct X(T...) { static void xoo(T){} }
    struct Y(T...) { static void yoo()(T){} }
    struct Z(T...) { static void zoo(U...)(T, U){} }

    struct V(T...) { static void voo()(T, ...){} }
    struct W(T...) { static void woo()(T...){} }

    struct R(T...) { static void roo(U...)(int, U, T){} }

    // OK
    foo([[10]]);
    boo([[10]]);

    // OK
    X!(int[1][]).xoo([[10]]);

    // NG!
    Y!().yoo();
    Y!(int).yoo(1);
    Y!(int, int[]).yoo(1, [10]);
    static assert(!__traits(compiles, Y!().yoo(1)));
    static assert(!__traits(compiles, Y!(int).yoo("a")));
    static assert(!__traits(compiles, Y!().yoo!(int)()));

    // NG!
    Z!().zoo();
    Z!().zoo([1], [1:1]);
    Z!(int, string).zoo(1, "a");
    Z!(int, string).zoo(1, "a", [1], [1:1]);
    Z!().zoo!()();
    static assert(!__traits(compiles, Z!().zoo!()(1)));     // (none) <- 1
    static assert(!__traits(compiles, Z!(int).zoo!()()));   // int <- (none)
    static assert(!__traits(compiles, Z!(int).zoo!()(""))); // int <- ""
    static assert(!__traits(compiles, Z!().zoo!(int)()));   // int <- (none)
    static assert(!__traits(compiles, Z!().zoo!(int)(""))); // int <- ""

    V!().voo(1,2,3);
    V!(int).voo(1,2,3);
    V!(int, long).voo(1,2,3);
    static assert(!__traits(compiles, V!(int).voo()));          // int <- (none)
    static assert(!__traits(compiles, V!(int, long).voo(1)));       // long <- (none)
    static assert(!__traits(compiles, V!(int, string).voo(1,2,3)));     // string <- 2

    W!().woo();
    //W!().woo(1, 2, 3);    // Access Violation
    {   // this behavior is consistent with:
        //alias TL = TypeTuple!();
        //void foo(TL...) {}
        //foo(1, 2, 3);     // Access Violation
        //pragma(msg, typeof(foo));   // void(...)  -> D-style variadic function?
    }
    W!(int,int[]).woo(1,2,3);
    W!(int,int[2]).woo(1,2,3);
    static assert(!__traits(compiles, W!(int,int,int).woo(1,2,3)));     // int... <- 2
    static assert(!__traits(compiles, W!(int,int).woo(1,2)));           // int... <- 2
    static assert(!__traits(compiles, W!(int,int[2]).woo(1,2)));    // int[2]... <- 2

    R!().roo(1, "", []);
    R!(int).roo(1, "", [], 1);
    R!(int, string).roo(1, "", [], 1, "");
    R!(int, string).roo(1, 2, "");
    static assert(!__traits(compiles, R!(int).roo(1, "", []))); // int <- []
    static assert(!__traits(compiles, R!(int, int).roo(1, "", [])));    // int <- []
    static assert(!__traits(compiles, R!(int, string).roo(1, 2, 3)));   // string <- 3

    // test case
    struct Tuple(T...) { this()(T values) {} }
    alias T = Tuple!(int[1][]);
    auto t = T([[10]]);
}

/******************************************/
// 9971

void goo9971()()
{
    auto g = &goo9971;
}

struct S9971
{
    void goo()()
    {
        auto g = &goo;
        static assert(is(typeof(g) == delegate));
    }
}

void test9971()
{
    goo9971!()();

    S9971.init.goo!()();
}

/******************************************/
// 9977

void test9977()
{
    struct S1(T) { T value; }
    auto func1(T)(T value) { return value; }
    static assert(is(S1!int == struct));
    assert(func1(10) == 10);

    template S2(T) { struct S2 { T value; } }
    template func2(T) { auto func2(T value) { return value; } }
    static assert(is(S2!int == struct));
    assert(func2(10) == 10);

    template X(T) { alias X = T[3]; }
    static assert(is(X!int == int[3]));

    int a;
    template Y(T) { alias Y = T[typeof(a)]; }
    static assert(is(Y!double == double[int]));

    int v = 10;
    template Z() { alias Z = v; }
    assert(v == 10);
    Z!() = 20;
    assert(v == 20);
}

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

enum T8848a(int[] a) = a;
enum T8848b(int[int] b) = b;
enum T8848c(void* c) = c;

static assert(T8848a!([1,2,3]) == [1,2,3]);
static assert(T8848b!([1:2,3:4]) == [1:2,3:4]);
static assert(T8848c!(null) == null);

/******************************************/
// 9990

auto initS9990() { return "hi"; }

class C9990(alias init) {}

alias SC9990 = C9990!(initS9990);

/******************************************/
// 10067

struct assumeSize10067(alias F) {}

template useItemAt10067(size_t idx, T)
{
    void impl(){ }

    alias useItemAt10067 = assumeSize10067!(impl);
}

useItemAt10067!(0, char) mapS10067;

/******************************************/
// 4072

void bug4072(T)(T x)
    if (is(typeof(bug4072(x))))
{}

static assert(!is(typeof(bug4072(7))));

/******************************************/
// 10074

template foo10074(F)
{
    enum foo10074 = false;
}
bool foo10074(F)(F f)
    if (foo10074!F)
{
    return false;
}

static assert(!is(typeof(foo10074(1))));

/******************************************/
// 10083

// [a-c] IFTI can find syntactic eponymous member
template foo10083a(T)
{
    int foo10083a(double) { return 1; }
    int foo10083a(T) { return 2; }
}
template foo10083b(T)
{
    int foo10083b(T) { return 1; }
    int foo10083b(T, T) { return 2; }
}
template foo10083c1(T)
{
    int foo10083c1(T) { return 1; }
    static if (true) { int x; }
}
template foo10083c2(T)
{
    int foo10083c2(T) { return 1; }
    static if (true) { int x; } else { int y; }
}

// [d-f] IFTI cannot find syntactic eponymous member
template foo10083d1(T)
{
    static if (true)
    {
        int foo10083d1(T) { return 1; }
    }
    else
    {
    }
}
template foo10083d2(T)
{
    static if (true)
    {
    }
    else
    {
        int foo10083d2(T) { return 1; }
    }
}
template foo10083e(T)
{
    static if (true)
    {
        int foo10083e(double arg) { return 1; }
    }
    int foo10083e(T arg) { return 2; }
}
template foo10083f(T)
{
    static if (true)
    {
        int foo10083f(T) { return 1; }
    }
    else
    {
        int foo10083f(T) { return 2; }
    }
}

void test10083()
{
    assert(foo10083a(1) == 2);
    assert(foo10083a!int(1) == 2);
    assert(foo10083a!int(1.0) == 1);
    static assert(!__traits(compiles, foo10083a!double(1)));
    static assert(!__traits(compiles, foo10083a!double(1.0)));
    static assert(!__traits(compiles, foo10083a!real(1)));
    assert(foo10083a!real(1.0) == 1);
    assert(foo10083a!real(1.0L) == 2);

    assert(foo10083b(2) == 1);
    assert(foo10083b(3, 4) == 2);
    static assert(!__traits(compiles, foo10083b(2, "")));

    assert(foo10083c1(1) == 1);
    assert(foo10083c2(1) == 1);

    static assert(!__traits(compiles, foo10083d1(2)));
    static assert(!__traits(compiles, foo10083d2(2)));
    static assert(!__traits(compiles, foo10083e(3)));
    static assert(!__traits(compiles, foo10083f(3)));
}

/******************************************/
// 10134

template ReturnType10134(alias func)
{
    static if (is(typeof(func) R == return))
        alias R ReturnType10134;
    else
        static assert(0);
}

struct Result10134(T) {}

template getResultType10134(alias func)
{
    static if(is(ReturnType10134!(func.exec) _ == Result10134!(T), T))
    {
        alias getResultType10134 = T;
    }
}

template f10134(alias func)
{
    Result10134!(getResultType10134!(func)) exec(int i)
    {
        return typeof(return)();
    }
}

template a10134()
{
    Result10134!(double) exec(int i)
    {
        return b10134!().exec(i);
    }
}

template b10134()
{
    Result10134!(double) exec(int i)
    {
        return f10134!(a10134!()).exec(i);
    }
}

pragma(msg, getResultType10134!(a10134!()));

/******************************************/
// 10313

void test10313()
{
    struct Nullable(T)
    {
        this()(inout T value) inout {}
    }

    struct S { S[] array; }
    S s;
    auto ns = Nullable!S(s);

    class C { C[] array; }
    C c;
    auto nc = Nullable!C(c);
}

/******************************************/
// 10498

template triggerIssue10498a()
{
    enum triggerIssue10498a = __traits(compiles, { T10498a; });
}

template PackedGenericTuple10498a(Args...)
{
    alias Args Tuple;
    enum e = triggerIssue10498a!();
}

struct S10498a { }

template T10498a()
{
    alias PackedGenericTuple10498a!S10498a T10498a;
}

void test10498a()
{
    alias T10498a!() t;
    static assert(is(t.Tuple[0])); // Fails -> OK
}

// --------

template triggerIssue10498b(A...)
{
    enum triggerIssue10498b = __traits(compiles, { auto a = A[0]; });
}

template PackedGenericTuple10498b(Args...)
{
    alias Args Tuple;
    enum e = triggerIssue10498b!Args;
}

template T10498b()
{
    struct S {} // The fact `S` is in `T` causes the problem
    alias PackedGenericTuple10498b!S T10498b;
}

void test10498b()
{
    alias T10498b!() t;
    static assert(is(t.Tuple[0]));
}

/******************************************/
// 10537

struct Iota10537
{
    int s,e,i;
    mixin Yield10537!q{ ; };
}

auto skipStrings10537(T)(T source)
{
    return "";
}

mixin template Yield10537(dstring code)
{
    alias X = typeof({ enum x = rewriteCode10537(code); }());
}

dstring rewriteCode10537(dstring code)
{
    skipStrings10537(code);  // IFTI causes forward reference
    return "";
}

/******************************************/
// 10558

template Template10558() {}

struct Struct10558(alias T){}

alias bar10558 = foo10558!(Template10558!());

template foo10558(alias T)
{
    alias foobar = Struct10558!T;

    void fun()
    {
        alias a = foo10558!T;
    }
}

/******************************************/
// 10592

void test10592()
{
    struct A(E)
    {
        int put()(const(E)[] data)
        {
            return 1;
        }

        int put()(const(dchar)[] data) if (!is(E == dchar))
        {
            return 2;
        }

        int put(C)(const(C)[] data) if (!is(C == dchar) && !is(E == C))
        {
            return 3;
        }
    }

    A!char x;
    assert(x.put("abcde"c) == 1);   // OK: hit 1
    assert(x.put("abcde"w) == 3);   // NG: this should hit 3
    assert(x.put("abcde"d) == 2);   // OK: hit 2
}

/******************************************/
// 11242

inout(T[]) fromString11242(T)(inout(char[]) s, T[] dst)
{
    return s;
}

void test11242()
{
    char[] a;
    fromString11242(a, a);
}

/******************************************/
// 10811

void foo10811a(R1, R2)(R1, R2) {}
template foo10811a(alias pred) { void foo10811a(R1, R2)(R1, R2) {} }

template foo10811b(alias pred) { void foo10811b(R1, R2)(R1, R2) {} }
void foo10811b(R1, R2)(R1, R2) {}

void test10811()
{
    foo10811a(1, 2);
    foo10811a!(a => a)(1, 2);

    foo10811b(1, 2);
    foo10811b!(a => a)(1, 2);
}

/******************************************/
// 10969

template A10969(T, U...) { alias A10969 = T; }
void foo10969(T, U...)(A10969!(T, U) a) {}

template B10969(T, U) { alias B10969 = T; }
void bar10969(T, U...)(B10969!(T, U[0]) a) {}

void test10969()
{
    foo10969!(int, float)(3);
    bar10969!(int, float)(3);
}

/******************************************/
// 11271

struct SmartPtr11271(T)
{
    ~this() {}
    void opAssign(U)(auto ref U rh) {}
}

void test11271()
{
    SmartPtr11271!Object a;
    a = SmartPtr11271!Object();
}

/******************************************/
// 11533

version (none)
{
struct S11533
{
    void put(alias fun)() { fun!int(); }
}
void test11533a()
{
    static void foo(T)() {}
    S11533 s;
    s.put!foo();
}

void test11533b()
{
    static void bar(alias fun)() { fun(); }
    void nested() {}
    bar!nested();
}

void test11533c()
{
    static struct Foo(alias fun)
    {
        auto call() { return fun(); }
    }
    int var = 1;
    auto getVar() { return var; }
    Foo!getVar foo;
    assert(foo.call() == var);
    var += 1;
    assert(foo.call() == var);
}

void test11533()
{
    test11533a();
    test11533b();
    test11533c();
}
}
else
{
void test11533()
{
}
}

/******************************************/
// 11553

struct Pack11553(T ...)
{
    alias Unpack = T;
    enum length = T.length;
}

template isPack11553(TList ...)
{
    static if (TList.length == 1 && is(Pack11553!(TList[0].Unpack) == TList[0]))
    {
        enum isPack11553 = true;
    }
    else
    {
        enum isPack11553 = false;
    }
}

template PartialApply11553(alias T, uint argLoc, Arg ...)
    if (Arg.length == 1)
{
    template PartialApply11553(L ...)
    {
        alias PartialApply11553 = T!(L[0 .. argLoc], Arg, L[argLoc .. $]);
    }
}

template _hasLength11553(size_t len, T)
{
    static if (T.length == len)
    {
        enum _hasLength11553 = true;
    }
    else
    {
        enum _hasLength11553 = false;
    }
}

alias _hasLength11553(size_t len) = PartialApply11553!(._hasLength11553, 0, len);


alias hl11553 = _hasLength11553!1;

// this segfaults
static if (!isPack11553!hl11553) { pragma(msg, "All good 1"); }

// these are fine
static if ( hl11553!(Pack11553!(5))) { pragma(msg, "All good 2"); }

static if (!hl11553!(Pack11553!( ))) { pragma(msg, "All good 3"); }

/******************************************/
// 11818

enum E11818 { e0, e1 }

struct SortedRange11818
{
    void fun(E11818 e = true ? E11818.e0 : E11818.e1)()
    {
    }
}

void test11818()
{
    SortedRange11818 s;
    s.fun();
}

/******************************************/
// 11843

void test11843()
{
    struct Foo
    {
        int x[string];
    }

    struct Bar(alias foo) {}

    enum bar1 = Bar!(Foo(["a": 1]))();
    enum bar2 = Bar!(Foo(["a": 1]))();
    static assert(is(typeof(bar1) == typeof(bar2)));

    enum foo1 = Foo(["a": 1]);
    enum foo2 = Foo(["b": -1]);
    static assert(!__traits(isSame, foo1, foo2));
    enum bar3 = Bar!foo1();
    enum bar4 = Bar!foo2();
    static assert(!is(typeof(bar3) == typeof(bar4)));
}

/******************************************/
// 11872

class Foo11872
{
    auto test(int v)() {}
    auto test(int v)(string) {}

    template Bar(T)
    {
        void test(T) {}
    }
}

void test11872()
{
    auto foo = new Foo11872();

    with (foo)
    {
        // ScopeExp(ti) -> DotTemplateInstanceExp(wthis, ti)
        foo.test!2();   // works
        test!2();       // works <- fails
        test!2;         // works <- fails

        // ScopeExp(ti) -> DotTemplateInstanceExp(wthis, ti) -> DotExp(wthis, ScopeExp)
        foo.Bar!int.test(1);    // works
        Bar!int.test(1);        // works <- fails
    }
}

/******************************************/
// 12042

struct S12042
{
    int[] t;

    void m()()
    {
        t = null;   // CTFE error -> OK
    }
}

int test12042()
{
    S12042 s;

    with (s)
        m!()();

    return 1;
}

static assert(test12042());

/******************************************/
// 12077

struct S12077(A) {}

alias T12077(alias T : Base!Args, alias Base, Args...) = Base;
static assert(__traits(isSame, T12077!(S12077!int), S12077));

alias U12077(alias T : Base!Args, alias Base, Args...) = Base;
alias U12077(      T : Base!Args, alias Base, Args...) = Base;
static assert(__traits(isSame, U12077!(S12077!int), S12077));

/******************************************/
// 12262

template Inst12262(T) { int x; }

enum fqnSym12262(alias a)                      = 1;
enum fqnSym12262(alias a : B!A, alias B, A...) = 2;

static assert(fqnSym12262!(Inst12262!(Object)) == 2);
static assert(fqnSym12262!(Inst12262!(Object).x) == 1);

/******************************************/
// 12264

struct S12264(A) {}

template AX12264(alias A1)                      { enum AX12264 = 1; }
template AX12264(alias A2 : B!A, alias B, A...) { enum AX12264 = 2; }
template AY12264(alias A1)                  { enum AY12264 = 1; }
template AY12264(alias A2 : B!int, alias B) { enum AY12264 = 2; }
template AZ12264(alias A1)               { enum AZ12264 = 1; }
template AZ12264(alias A2 : S12264!T, T) { enum AZ12264 = 2; }
static assert(AX12264!(S12264!int) == 2);
static assert(AY12264!(S12264!int) == 2);
static assert(AZ12264!(S12264!int) == 2);

template TX12264(T1)                      { enum TX12264 = 1; }
template TX12264(T2 : B!A, alias B, A...) { enum TX12264 = 2; }
template TY12264(T1)                  { enum TY12264 = 1; }
template TY12264(T2 : B!int, alias B) { enum TY12264 = 2; }
template TZ12264(T1)               { enum TZ12264 = 1; }
template TZ12264(T2 : S12264!T, T) { enum TZ12264 = 2; }
static assert(TX12264!(S12264!int) == 2);
static assert(TY12264!(S12264!int) == 2);
static assert(TZ12264!(S12264!int) == 2);

/******************************************/
// 12122

enum N12122 = 1;

void foo12122(T)(T[N12122]) if(is(T == int)) {}

void test12122()
{
    int[N12122] data;
    foo12122(data);
}

/******************************************/
// 12186

template map_front12186(fun...)
{
    auto map_front12186(Range)(Range r)
    {
        return fun[0](r[0]);
    }
}

void test12186()
{
    immutable int[][] mat;

    mat.map_front12186!((in r) => 0);              // OK
    mat.map_front12186!((const r) => 0);           // OK
    mat.map_front12186!((immutable int[] r) => 0); // OK
    mat.map_front12186!((immutable r) => 0);       // OK <- Error
}

/******************************************/
// 12207

void test12207()
{
    static struct S
    {
        static void f(T)(T) {}
    }

    immutable S s;

    s.f(1);
}

/******************************************/
// 12263

template A12263(alias a) { int x; }
template B12263(alias a) { int x; }

template fqnSym12263(alias T : B12263!A, alias B12263, A...)
{
    enum fqnSym12263 = true;
}

static assert(fqnSym12263!(A12263!(Object)));
static assert(fqnSym12263!(B12263!(Object)));

/******************************************/
// 12290

void test12290()
{
    short[] arrS;
    float[] arrF;
    double[] arrD;
    real[] arrR;
    string cstr;
    wstring wstr;
    dstring dstr;
    short[short] aa;

    auto func1a(E)(E[], E) { return E.init; }
    auto func1b(E)(E, E[]) { return E.init; }

    static assert(is(typeof(func1a(arrS, 1)) == short));
    static assert(is(typeof(func1b(1, arrS)) == short));
    static assert(is(typeof(func1a(arrF, 1.0)) == float));
    static assert(is(typeof(func1b(1.0, arrF)) == float));
    static assert(is(typeof(func1a(arrD, 1.0L)) == double));
    static assert(is(typeof(func1b(1.0L, arrD)) == double));
    static assert(is(typeof(func1a(arrR, 1)) == real));
    static assert(is(typeof(func1b(1, arrR)) == real));
    static assert(is(typeof(func1a("str" , 'a')) == immutable  char));
    static assert(is(typeof(func1b('a', "str" )) == immutable  char));
    static assert(is(typeof(func1a("str"c, 'a')) == immutable  char));
    static assert(is(typeof(func1b('a', "str"c)) == immutable  char));
    static assert(is(typeof(func1a("str"w, 'a')) == immutable wchar));
    static assert(is(typeof(func1b('a', "str"w)) == immutable wchar));
    static assert(is(typeof(func1a("str"d, 'a')) == immutable dchar));
    static assert(is(typeof(func1b('a', "str"d)) == immutable dchar));
    static assert(is(typeof(func1a([1,2,3], 1L)) == long));
    static assert(is(typeof(func1b(1L, [1,2,3])) == long));
    static assert(is(typeof(func1a([1,2,3], 1.5)) == double));
    static assert(is(typeof(func1b(1.5, [1,2,3])) == double));
    static assert(is(typeof(func1a(["a","b"], "s"c)) ==  string));
    static assert(is(typeof(func1b("s"c, ["a","b"])) ==  string));
    static assert(is(typeof(func1a(["a","b"], "s"w)) == wstring));
    static assert(is(typeof(func1b("s"w, ["a","b"])) == wstring));
    static assert(is(typeof(func1a(["a","b"], "s"d)) == dstring));
    static assert(is(typeof(func1b("s"d, ["a","b"])) == dstring));

    auto func2a(K, V)(V[K], K, V) { return V[K].init; }
    auto func2b(K, V)(V, K, V[K]) { return V[K].init; }

    static assert(is(typeof(func2a(aa, 1, 1)) == short[short]));
    static assert(is(typeof(func2b(1, 1, aa)) == short[short]));
    static assert(is(typeof(func2a([1:10,2:20,3:30], 1L, 10L)) == long[long]));
    static assert(is(typeof(func2b(1L, 10L, [1:20,2:20,3:30])) == long[long]));

    auto func3a(T)(T, T) { return T.init; }
    auto func3b(T)(T, T) { return T.init; }

    static assert(is(typeof(func3a(arrS, null)) == short[]));
    static assert(is(typeof(func3b(null, arrS)) == short[]));
    static assert(is(typeof(func3a(arrR, null)) == real[]));
    static assert(is(typeof(func3b(null, arrR)) == real[]));
    static assert(is(typeof(func3a(cstr, "str")) ==  string));
    static assert(is(typeof(func3b("str", cstr)) ==  string));
    static assert(is(typeof(func3a(wstr, "str")) == wstring));
    static assert(is(typeof(func3b("str", wstr)) == wstring));
    static assert(is(typeof(func3a(dstr, "str")) == dstring));
    static assert(is(typeof(func3b("str", dstr)) == dstring));
    static assert(is(typeof(func3a("str1" , "str2"c)) ==  string));
    static assert(is(typeof(func3b("str1"c, "str2" )) ==  string));
    static assert(is(typeof(func3a("str1" , "str2"w)) == wstring));
    static assert(is(typeof(func3b("str1"w, "str2" )) == wstring));
    static assert(is(typeof(func3a("str1" , "str2"d)) == dstring));
    static assert(is(typeof(func3b("str1"d, "str2" )) == dstring));

    inout(V) get(K, V)(inout(V[K]) aa, K key, lazy V defaultValue) { return V.init; }

    short[short] hash12220;
    short res12220 = get(hash12220, 1, 1);

    short[short] hash12221;
    enum Key12221 : short { a }
    get(hash12221, Key12221.a, Key12221.a);

    int[][string] mapping13026;
    int[] v = get(mapping13026, "test", []);
}

/******************************************/
// 12292

void test12292()
{
    void fun(T : string)(T data) {}

    ubyte[3] sa;
    static assert(!__traits(compiles, fun(sa)));
    static assert(!__traits(compiles, { alias f = fun!(ubyte[3]); }));
}

/******************************************/
// 12376

static auto encode12376(size_t sz)(dchar ch) if (sz > 1)
{
    undefined;
}

void test12376()
{
    enum x = __traits(compiles, encode12376!2(x));
}

/******************************************/
// 12447

enum   test12447(string str) = str; // [1]
string test12447(T...)(T args) if (T.length) { return args[0]; }    // [2]

// With [1]: The template parameter str cannot be be deduced -> no match
// With [2]: T is deduced to a type tuple (string), then match to the function call.
static assert(test12447("foo") == "foo");

// With [1]: template parameter str is deduced to "bar", then match.
// With [2]: T is deduced to an expression tuple ("bar"), but it will make invalid the function signature (T args).
//           The failure should be masked silently and prefer the 1st version.
static assert(test12447!("bar") == "bar");

/******************************************/
// 12651

alias TemplateArgsOf12651(alias T : Base!Args, alias Base, Args...) = Args;

struct S12651(T) { }

static assert(!__traits(compiles, TemplateArgsOf12651!(S12651!int, S, float)));

/******************************************/
// 12719

struct A12719
{
    B12719!int b();
}

struct B12719(T)
{
    A12719 a;
    void m()
    {
        auto v = B12719!T.init;
    }
}

// --------

enum canDoIt12719(R) = is(typeof(W12719!R));

struct W12719(R)
{
    R r;
    static if (canDoIt12719!R) {}
}

W12719!int a12719;

/******************************************/
// 12746

template foo12746()
{
    void bar()
    {
        static assert(!__traits(compiles, bar(1)));
    }
    alias foo12746 = bar;
}

void foo12746(int)
{
    assert(0);
}

void test12746()
{
    foo12746(); // instantiate
}

/******************************************/
// 12748

void foo12748(S, C : typeof(S.init[0]))(S s, C c)
{
}

void test12748()
{
    foo12748("abc", 'd');
}

/******************************************/
// 9708

struct S9708
{
    void f()(inout(Object)) inout {}
}

void test9708()
{
    S9708 s;
    s.f(new Object);
}

/******************************************/
// 12880

void f12880(T)(in T value) { static assert(is(T == string)); }
void test12880() { f12880(string.init); }

/******************************************/
// 13087

struct Vec13087
{
    int x;
    void m()                      { auto n = component13087!(this, 'x'); }
    void c() const                { auto n = component13087!(this, 'x'); }
    void w() inout                { auto n = component13087!(this, 'x'); }
    void wc() inout const         { auto n = component13087!(this, 'x'); }
    void s() shared               { auto n = component13087!(this, 'x'); }
    void sc() shared const        { auto n = component13087!(this, 'x'); }
    void sw() shared inout        { auto n = component13087!(this, 'x'); }
    void swc() shared inout const { auto n = component13087!(this, 'x'); }
    void i() immutable            { auto n = component13087!(this, 'x'); }
}

template component13087(alias vec, char c)
{
    alias component13087 = vec.x;
}

/******************************************/
// 13127

/+void test13127(inout int = 0)
{
                       int []   ma1;
                 const(int)[]   ca1;
                 const(int[])   ca2;
           inout(      int)[]  wma1;
           inout(      int[])  wma2;
           inout(const int)[]  wca1;
           inout(const int[])  wca2;
             immutable(int)[]   ia1;
             immutable(int[])   ia2;
    shared(            int)[]  sma1;
    shared(            int[])  sma2;
    shared(      const int)[]  sca1;
    shared(      const int[])  sca2;
    shared(inout       int)[] swma1;
    shared(inout       int[]) swma2;
    shared(inout const int)[] swca1;
    shared(inout const int[]) swca2;

    /* In all cases, U should be deduced to top-unqualified type.
     */

    /* Parameter is (shared) mutable
     */
    U f_m(U)(       U) { return null; }
    U fsm(U)(shared U) { return null; }
    // 9 * 2 - 1
    static assert(is(typeof(f_m(  ma1))  ==                    int []));
    static assert(is(typeof(f_m(  ca1))  ==              const(int)[]));
    static assert(is(typeof(f_m(  ca2))  ==              const(int)[]));
    static assert(is(typeof(f_m( wma1))  ==        inout(      int)[]));
    static assert(is(typeof(f_m( wma2))  ==        inout(      int)[]));
    static assert(is(typeof(f_m( wca1))  ==        inout(const int)[]));
    static assert(is(typeof(f_m( wca2))  ==        inout(const int)[]));
    static assert(is(typeof(f_m(  ia1))  ==          immutable(int)[]));
    static assert(is(typeof(f_m(  ia2))  ==          immutable(int)[]));
    static assert(is(typeof(f_m( sma1))  == shared(            int)[]));
    static assert(is(typeof(f_m( sma2))  == shared(            int)[]));  // <- shared(int[])
    static assert(is(typeof(f_m( sca1))  == shared(      const int)[]));
    static assert(is(typeof(f_m( sca2))  == shared(      const int)[]));  // <- shared(const(int)[])
    static assert(is(typeof(f_m(swma1))  == shared(inout       int)[]));
    static assert(is(typeof(f_m(swma2))  == shared(inout       int)[]));  // <- shared(inout(int[]))
    static assert(is(typeof(f_m(swca1))  == shared(inout const int)[]));
    static assert(is(typeof(f_m(swca2))  == shared(inout const int)[]));  // <- shared(inout(const(int))[])
    // 9 * 2 - 1
    static assert(is(typeof(fsm(  ma1))) == false);
    static assert(is(typeof(fsm(  ca1))) == false);
    static assert(is(typeof(fsm(  ca2))) == false);
    static assert(is(typeof(fsm( wma1))) == false);
    static assert(is(typeof(fsm( wma2))) == false);
    static assert(is(typeof(fsm( wca1))) == false);
    static assert(is(typeof(fsm( wca2))) == false);
    static assert(is(typeof(fsm(  ia1))) == false);
    static assert(is(typeof(fsm(  ia2))) == false);
    static assert(is(typeof(fsm( sma1))  == shared(            int)[]));  // <- NG
    static assert(is(typeof(fsm( sma2))  == shared(            int)[]));
    static assert(is(typeof(fsm( sca1))  == shared(      const int)[]));  // <- NG
    static assert(is(typeof(fsm( sca2))  == shared(      const int)[]));
    static assert(is(typeof(fsm(swma1))  == shared(inout       int)[]));  // <- NG
    static assert(is(typeof(fsm(swma2))  == shared(inout       int)[]));
    static assert(is(typeof(fsm(swca1))  == shared(inout const int)[]));  // <- NG
    static assert(is(typeof(fsm(swca2))  == shared(inout const int)[]));

    /* Parameter is (shared) const
     */
    U f_c(U)(       const U) { return null; }
    U fsc(U)(shared const U) { return null; }
    // 9 * 2 - 1
    static assert(is(typeof(f_c(  ma1))  ==                    int []));
    static assert(is(typeof(f_c(  ca1))  ==              const(int)[]));
    static assert(is(typeof(f_c(  ca2))  ==              const(int)[]));
    static assert(is(typeof(f_c( wma1))  ==        inout(      int)[]));
    static assert(is(typeof(f_c( wma2))  ==        inout(      int)[]));
    static assert(is(typeof(f_c( wca1))  ==        inout(const int)[]));
    static assert(is(typeof(f_c( wca2))  ==        inout(const int)[]));
    static assert(is(typeof(f_c(  ia1))  ==          immutable(int)[]));
    static assert(is(typeof(f_c(  ia2))  ==          immutable(int)[]));
    static assert(is(typeof(f_c( sma1))  == shared(            int)[]));
    static assert(is(typeof(f_c( sma2))  == shared(            int)[]));  // <- shared(int[])
    static assert(is(typeof(f_c( sca1))  == shared(      const int)[]));
    static assert(is(typeof(f_c( sca2))  == shared(      const int)[]));  // <- shared(const(int)[])
    static assert(is(typeof(f_c(swma1))  == shared(inout       int)[]));
    static assert(is(typeof(f_c(swma2))  == shared(inout       int)[]));  // shared(inout(int)[])
    static assert(is(typeof(f_c(swca1))  == shared(inout const int)[]));
    static assert(is(typeof(f_c(swca2))  == shared(inout const int)[]));  // shared(inout(const(int))[])
    // 9 * 2 - 1
    static assert(is(typeof(fsc(  ma1))) == false);
    static assert(is(typeof(fsc(  ca1))) == false);
    static assert(is(typeof(fsc(  ca2))) == false);
    static assert(is(typeof(fsc( wma1))) == false);
    static assert(is(typeof(fsc( wma2))) == false);
    static assert(is(typeof(fsc( wca1))) == false);
    static assert(is(typeof(fsc( wca2))) == false);
    static assert(is(typeof(fsc(  ia1))  ==          immutable(int)[]));  // <- NG
    static assert(is(typeof(fsc(  ia2))  ==          immutable(int)[]));  // <- NG
    static assert(is(typeof(fsc( sma1))  == shared(            int)[]));  // <- NG
    static assert(is(typeof(fsc( sma2))  == shared(            int)[]));
    static assert(is(typeof(fsc( sca1))  == shared(      const int)[]));  // <- NG
    static assert(is(typeof(fsc( sca2))  == shared(      const int)[]));
    static assert(is(typeof(fsc(swma1))  == shared(inout       int)[]));  // <- NG
    static assert(is(typeof(fsc(swma2))  == shared(inout       int)[]));
    static assert(is(typeof(fsc(swca1))  == shared(inout const int)[]));  // <- NG
    static assert(is(typeof(fsc(swca2))  == shared(inout const int)[]));

    /* Parameter is immutable
     */
    U fi(U)(immutable U) { return null; }
    // 9 * 2 - 1
    static assert(is(typeof(fi(  ma1))) == false);
    static assert(is(typeof(fi(  ca1))) == false);
    static assert(is(typeof(fi(  ca2))) == false);
    static assert(is(typeof(fi( wma1))) == false);
    static assert(is(typeof(fi( wma2))) == false);
    static assert(is(typeof(fi( wca1))) == false);
    static assert(is(typeof(fi( wca2))) == false);
    static assert(is(typeof(fi(  ia1))  == immutable(int)[]));  // <- NG
    static assert(is(typeof(fi(  ia2))  == immutable(int)[]));  // <- NG
    static assert(is(typeof(fi( sma1))) == false);
    static assert(is(typeof(fi( sma2))) == false);
    static assert(is(typeof(fi( sca1))) == false);
    static assert(is(typeof(fi( sca2))) == false);
    static assert(is(typeof(fi(swma1))) == false);
    static assert(is(typeof(fi(swma2))) == false);
    static assert(is(typeof(fi(swca1))) == false);
    static assert(is(typeof(fi(swca2))) == false);

    /* Parameter is (shared) inout
     */
    U f_w(U)(       inout U) { return null; }
    U fsw(U)(shared inout U) { return null; }
    // 9 * 2 - 1
    static assert(is(typeof(f_w(  ma1))  ==              int []));
    static assert(is(typeof(f_w(  ca1))  ==              int []));  // <- const(int)[]
    static assert(is(typeof(f_w(  ca2))  ==              int []));  // <- const(int)[]
    static assert(is(typeof(f_w( wma1))  ==              int []));  // <- inout(int)[]
    static assert(is(typeof(f_w( wma2))  ==              int []));  // <- inout(int)[]
    static assert(is(typeof(f_w( wca1))  ==        const(int)[]));  // <- inout(const(int))[]
    static assert(is(typeof(f_w( wca2))  ==        const(int)[]));  // <- inout(const(int))[]
    static assert(is(typeof(f_w(  ia1))  ==              int []));  // <- immutable(int)[]
    static assert(is(typeof(f_w(  ia2))  ==              int []));  // <- immutable(int)[]
    static assert(is(typeof(f_w( sma1))  == shared(      int)[]));
    static assert(is(typeof(f_w( sma2))  == shared(      int)[]));  // <- shared(int[])
    static assert(is(typeof(f_w( sca1))  == shared(      int)[]));  // <- shared(const(int))[]
    static assert(is(typeof(f_w( sca2))  == shared(      int)[]));  // <- shared(const(int)[])
    static assert(is(typeof(f_w(swma1))  == shared(      int)[]));  // <- shared(inout(int))[]
    static assert(is(typeof(f_w(swma2))  == shared(      int)[]));  // <- shared(inout(int)[])
    static assert(is(typeof(f_w(swca1))  == shared(const int)[]));  // <- shared(inout(const(int)))[]
    static assert(is(typeof(f_w(swca2))  == shared(const int)[]));  // <- shared(inout(const(int))[])
    // 9 * 2 - 1
    static assert(is(typeof(fsw(  ma1))) == false);
    static assert(is(typeof(fsw(  ca1))) == false);
    static assert(is(typeof(fsw(  ca2))) == false);
    static assert(is(typeof(fsw( wma1))) == false);
    static assert(is(typeof(fsw( wma2))) == false);
    static assert(is(typeof(fsw( wca1))) == false);
    static assert(is(typeof(fsw( wca2))) == false);
    static assert(is(typeof(fsw(  ia1))  ==              int []));  // <- NG
    static assert(is(typeof(fsw(  ia2))  ==              int []));  // <- NG
    static assert(is(typeof(fsw( sma1))  ==              int []));  // <- NG
    static assert(is(typeof(fsw( sma2))  ==              int []));
    static assert(is(typeof(fsw( sca1))  ==              int []));  // <- NG
    static assert(is(typeof(fsw( sca2))  ==              int []));  // const(int)[]
    static assert(is(typeof(fsw(swma1))  ==              int []));  // <- NG
    static assert(is(typeof(fsw(swma2))  ==              int []));  // inout(int)[]
    static assert(is(typeof(fsw(swca1))  ==        const(int)[]));  // <- NG
    static assert(is(typeof(fsw(swca2))  ==        const(int)[]));  // <- inout(const(int))[]

    /* Parameter is (shared) inout const
     */
    U f_wc(U)(       inout const U) { return null; }
    U fswc(U)(shared inout const U) { return null; }
    // 9 * 2 - 1
    static assert(is(typeof(f_wc(  ma1))  ==        int []));
    static assert(is(typeof(f_wc(  ca1))  ==        int []));  // <- const(int)[]
    static assert(is(typeof(f_wc(  ca2))  ==        int []));  // <- const(int)[]
    static assert(is(typeof(f_wc( wma1))  ==        int []));  // <- inout(int)[]
    static assert(is(typeof(f_wc( wma2))  ==        int []));  // <- inout(int)[]
    static assert(is(typeof(f_wc( wca1))  ==        int []));  // <- inout(const(int))[]
    static assert(is(typeof(f_wc( wca2))  ==        int []));  // <- inout(const(int))[]
    static assert(is(typeof(f_wc(  ia1))  ==        int []));  // <- immutable(int)[]
    static assert(is(typeof(f_wc(  ia2))  ==        int []));  // <- immutable(int)[]
    static assert(is(typeof(f_wc( sma1))  == shared(int)[]));
    static assert(is(typeof(f_wc( sma2))  == shared(int)[]));  // <- shared(int[])
    static assert(is(typeof(f_wc( sca1))  == shared(int)[]));  // <- shared(const(int))[]
    static assert(is(typeof(f_wc( sca2))  == shared(int)[]));  // <- shared(const(int)[])
    static assert(is(typeof(f_wc(swma1))  == shared(int)[]));  // <- shared(inout(int))[]
    static assert(is(typeof(f_wc(swma2))  == shared(int)[]));  // <- shared(inout(int)[])
    static assert(is(typeof(f_wc(swca1))  == shared(int)[]));  // <- shared(inout(const(int)))[]
    static assert(is(typeof(f_wc(swca2))  == shared(int)[]));  // <- shared(inout(const(int))[])
    // 9 * 2 - 1
    static assert(is(typeof(fswc(  ma1))) == false);
    static assert(is(typeof(fswc(  ca1))) == false);
    static assert(is(typeof(fswc(  ca2))) == false);
    static assert(is(typeof(fswc( wma1))) == false);
    static assert(is(typeof(fswc( wma2))) == false);
    static assert(is(typeof(fswc( wca1))) == false);
    static assert(is(typeof(fswc( wca2))) == false);
    static assert(is(typeof(fswc(  ia1))  ==        int []));  // <- NG
    static assert(is(typeof(fswc(  ia2))  ==        int []));  // <- NG
    static assert(is(typeof(fswc( sma1))  ==        int []));  // <- NG
    static assert(is(typeof(fswc( sma2))  ==        int []));
    static assert(is(typeof(fswc( sca1))  ==        int []));  // <- NG
    static assert(is(typeof(fswc( sca2))  ==        int []));  // <- const(int)[]
    static assert(is(typeof(fswc(swma1))  ==        int []));  // <- NG
    static assert(is(typeof(fswc(swma2))  ==        int []));  // <- inout(int)[]
    static assert(is(typeof(fswc(swca1))  ==        int []));  // <- NG
    static assert(is(typeof(fswc(swca2))  ==        int []));  // <- inout(const(int))[]
}+/

void test13127a()
{
    void foo(T)(in T[] src, T[] dst) { static assert(is(T == int[])); }

    int[][] a;
    foo(a, a);
}

/******************************************/
// 13159

template maxSize13159(T...)
{
    static if (T.length == 1)
    {
        enum size_t maxSize13159 = T[0].sizeof;
    }
    else
    {
        enum size_t maxSize13159 =
            T[0].sizeof >= maxSize13159!(T[1 .. $])
                ? T[0].sizeof
                : maxSize13159!(T[1 .. $]);
    }
}

struct Node13159
{
    struct Pair
    {
        Node13159 value;
    }

    //alias Algebraic!(Node[], int) Value;
    enum n = maxSize13159!(Node13159[], int);
}

/******************************************/
// 13180

void test13180()
{
    inout(V) get1a(K, V)(inout(V[K]) aa, lazy inout(V) defaultValue)
    {
        static assert(is(V == string));
        static assert(is(K == string));
        return defaultValue;
    }
    inout(V) get1b(K, V)(lazy inout(V) defaultValue, inout(V[K]) aa)
    {
        static assert(is(V == string));
        static assert(is(K == string));
        return defaultValue;
    }

    inout(V) get2a(K, V)(inout(V)[K] aa, lazy inout(V) defaultValue)
    {
        static assert(is(V == string));
        static assert(is(K == string));
        return defaultValue;
    }
    inout(V) get2b(K, V)(lazy inout(V) defaultValue, inout(V)[K] aa)
    {
        static assert(is(V == string));
        static assert(is(K == string));
        return defaultValue;
    }
    string def;
    string[string] aa;
    string s1a = get1a(aa, def);
    string s1b = get1b(def, aa);
    string s2a = get2a(aa, def);
    string s2b = get2b(def, aa);
}

/******************************************/
// 13204

struct A13204(uint v)
{
    alias whatever = A13204y;
    static assert(is(whatever == A13204));
}
alias A13204x = A13204!1;
alias A13204y = A13204x;

struct B13204(uint v)
{
    alias whatever = B13204z;
    static assert(is(whatever == B13204));
}
alias B13204x = B13204!1;
alias B13204y = B13204x;
alias B13204z = B13204y;

void test13204()
{
    static assert(is(A13204x == A13204!1));
    static assert(is(A13204x == A13204!1.whatever));
    static assert(is(A13204x == A13204y));

    static assert(is(B13204x == B13204!1));
    static assert(is(B13204x == B13204!1.whatever));
    static assert(is(B13204x == B13204y));
    static assert(is(B13204x == B13204z));
}

/******************************************/
// 8462 (dup of 13204)

alias FP8462 = void function(C8462.Type arg);

class C8462
{
    enum Type { Foo }
    alias funcPtrPtr = FP8462*;
}

/******************************************/
// 13218

template isCallable13218(T...)
    if (T.length == 1)
{
    static assert(0);
}

template ParameterTypeTuple13218(func...)
    if (func.length == 1 && isCallable13218!func)
{
    static assert(0);
}

struct R13218
{
    private static string mangleFuncPtr(ArgTypes...)()
    {
        string result = "fnp_";
        foreach (T; ArgTypes)
            result ~= T.mangleof;
        return result;
    }
    void function(int) fnp_i;
    double delegate(double) fnp_d;

    void opAssign(FnT)(FnT func)
    {
        mixin(mangleFuncPtr!( ParameterTypeTuple13218!FnT) ~ " = func;");   // parsed as TypeInstance
      //mixin(mangleFuncPtr!(.ParameterTypeTuple13218!FnT) ~ " = func;");   // parsed as DotTemplateInstanceExp -> works
    }
}

/******************************************/
// 13219

struct Map13219(V) {}

void test13219a(alias F, VA, VB)(Map13219!VA a, Map13219!VB b)
if (is(VA : typeof(F(VA.init, VB.init))))
{}

void test13219b(alias F)()
{
    test13219a!((a, b) => b)(Map13219!int.init, Map13219!int.init);
}

void test13219()
{
    int x;
    test13219b!x();
}

/******************************************/
// 13223

void test13223()
{
    T[] f1(T)(T[] a1, T[] a2)
    {
        static assert(is(T == int));
        return a1 ~ a2;
    }
    T[] f2(T)(T[] a1, T[] a2)
    {
        static assert(is(T == int));
        return a1 ~ a2;
    }
    int[] a = [1, 2];
    static assert(is(typeof(f1(a, [])) == int[]));
    static assert(is(typeof(f2([], a)) == int[]));
    static assert(is(typeof(f1(a, null)) == int[]));
    static assert(is(typeof(f2(null, a)) == int[]));

    T[] f3(T)(T[] a) { return a; }
    static assert(is(typeof(f3([])) == void[]));
    static assert(is(typeof(f3(null)) == void[]));

    T f4(T)(T a) { return a; }
    static assert(is(typeof(f4([])) == void[]));
    static assert(is(typeof(f4(null)) == typeof(null)));

    T[][] f5(T)(T[][] a) { return a; }
    static assert(is(typeof(f5([])) == void[][]));
    static assert(is(typeof(f5(null)) == void[][]));

    void translate(C = immutable char)(const(C)[] toRemove)
    {
        static assert(is(C == char));
    }
    translate(null);
}

void test13223a()
{
    T f(T)(T, T) { return T.init; }

    immutable i = 0;
    const c = 0;
    auto m = 0;
    shared s = 0;

    static assert(is(typeof(f(i, i)) == immutable int));
    static assert(is(typeof(f(i, c)) ==     const int));
    static assert(is(typeof(f(c, i)) ==     const int));
    static assert(is(typeof(f(i, m)) ==           int));
    static assert(is(typeof(f(m, i)) ==           int));
    static assert(is(typeof(f(c, m)) ==           int));
    static assert(is(typeof(f(m, c)) ==           int));
    static assert(is(typeof(f(m, m)) ==           int));
    static assert(is(typeof(f(i, s)) ==    shared int));
    static assert(is(typeof(f(s, i)) ==    shared int));
    static assert(is(typeof(f(c, s)) ==    shared int));
    static assert(is(typeof(f(s, c)) ==    shared int));
    static assert(is(typeof(f(s, s)) ==    shared int));
    static assert(is(typeof(f(s, m)) ==           int));
    static assert(is(typeof(f(m, s)) ==           int));
}

/******************************************/
// 13235

struct Tuple13235(T...)
{
    T expand;
    alias expand field;

    this(T values)
    {
        field = values;
    }
}
struct Foo13235
{
    Tuple13235!(int, Foo13235)* foo;
}

template Inst13235(T...)
{
    struct Tuple
    {
        T expand;
        alias expand field;

        this(T values)
        {
            field = values;
        }
    }
    alias Inst13235 = Tuple*;
}
struct Bar13235
{
    Inst13235!(int, Bar13235) bar;
}

void test13235()
{
    alias Tup1 = Tuple13235!(int, Foo13235);
    assert(Tup1(1, Foo13235()).expand[0] == 1);

    alias Tup2 = typeof(*Inst13235!(int, Bar13235).init);
    assert(Tup2(1, Bar13235()).expand[0] == 1);
}

/******************************************/
// 13252

alias TypeTuple13252(T...) = T;

static assert(is(typeof(TypeTuple13252!(cast(int )1)[0]) == int ));
static assert(is(typeof(TypeTuple13252!(cast(long)1)[0]) == long));

static assert(is(typeof(TypeTuple13252!(cast(float )3.14)[0]) == float ));
static assert(is(typeof(TypeTuple13252!(cast(double)3.14)[0]) == double));

static assert(is(typeof(TypeTuple13252!(cast(cfloat )(1 + 2i))[0]) == cfloat ));
static assert(is(typeof(TypeTuple13252!(cast(cdouble)(1 + 2i))[0]) == cdouble));

static assert(is(typeof(TypeTuple13252!(cast(string  )null)[0]) == string  ));
static assert(is(typeof(TypeTuple13252!(cast(string[])null)[0]) == string[]));  // OK <- NG

static assert(is(typeof(TypeTuple13252!(cast(wstring)"abc")[0]) == wstring));
static assert(is(typeof(TypeTuple13252!(cast(dstring)"abc")[0]) == dstring));

static assert(is(typeof(TypeTuple13252!(cast(int[] )[])[0]) == int[] ));
static assert(is(typeof(TypeTuple13252!(cast(long[])[])[0]) == long[]));        // OK <- NG

struct S13252 { }
static assert(is(typeof(TypeTuple13252!(const     S13252())[0]) ==     const(S13252)));
static assert(is(typeof(TypeTuple13252!(immutable S13252())[0]) == immutable(S13252)));     // OK <- NG

/******************************************/
// 13294

void test13294()
{
    void f(T)(const ref T src, ref T dst)
    {
        pragma(msg, "T = ", T);
        static assert(!is(T == const));
    }
    {
        const byte src;
              byte dst;
        f(src, dst);
    }
    {
        const char src;
              char dst;
        f(src, dst);
    }

    // 13351
    T add(T)(in T x, in T y)
    {
        T z;
        z = x + y;
        return z;
    }
    const double a = 1.0;
    const double b = 2.0;
    double c;
    c = add(a,b);
}

/******************************************/
// 13299

struct Foo13299
{
    Foo13299 opDispatch(string name)(int a, int[] b...)
    if (name == "bar")
    {
        return Foo13299();
    }

    Foo13299 opDispatch(string name)()
    if (name != "bar")
    {
        return Foo13299();
    }
}

void test13299()
{
    Foo13299()
        .bar(0)
        .bar(1)
        .bar(2);

    Foo13299()
        .opDispatch!"bar"(0)
        .opDispatch!"bar"(1)
        .opDispatch!"bar"(2);
}

/******************************************/
// 13333

template AliasThisTypeOf13333(T)
{
    static assert(0, T.stringof);  // T.stringof is important
}

template StaticArrayTypeOf13333(T)
{
    static if (is(AliasThisTypeOf13333!T AT))
        alias X = StaticArrayTypeOf13333!AT;
    else
        alias X = T;

    static if (is(X : E[n], E, size_t n))
        alias StaticArrayTypeOf13333 = X;
    else
        static assert(0, T.stringof~" is not a static array type");
}

enum bool isStaticArray13333(T) = is(StaticArrayTypeOf13333!T);

struct VaraiantN13333(T)
{
    static if (isStaticArray13333!T)
        ~this() { static assert(0); }
}

struct DummyScope13333
{
    alias A = VaraiantN13333!C;

    static class C
    {
        A entity;
    }
}

void test13333()
{
    struct DummyScope
    {
        alias A = VaraiantN13333!C;

        static class C
        {
            A entity;
        }
    }
}

/******************************************/
// 13374

int f13374(alias a)()  { return 1; }
int f13374(string s)() { return 2; }

void x13374(int i) {}

void test13374()
{
    assert(f13374!x13374() == 1);
}

/******************************************/
// 14109

string f14109() { return "a"; }
string g14109()() { return "a"; }

struct S14109(string s) { static assert(s == "a"); }

alias X14109 = S14109!(f14109);
alias Y14109 = S14109!(g14109!());
static assert(is(X14109 == Y14109));

/******************************************/
// 13378

struct Vec13378(size_t n, T, string as)
{
    T[n] data;
}

void doSome13378(size_t n, T, string as)(Vec13378!(n,T,as) v) {}

void test13378()
{
    auto v = Vec13378!(3, float, "xyz")([1,2,3]);
    doSome13378(v);
}

/******************************************/
// 13379

void test13379()
{
    match13379("");
}

auto match13379(RegEx )(RegEx  re)
if (is(RegEx == Regex13379!char))       // #1 Regex!char (speculative && tinst == NULL)
{}
auto match13379(String)(String re)
{}

struct Regex13379(Char)
{
    ShiftOr13379!Char kickstart;        // #2 ShiftOr!char (speculative && tinst == Regex!char)
}
struct ShiftOr13379(Char)
{
    this(ref Regex13379!Char re)        // #3 Regex!Char (speculative && tinst == ShiftOr!char)
    {
        uint n_length;
        uint idx;
        n_length = min13379(idx, n_length);
    }
}

template MinType13379(T...)
{
    alias MinType13379 = T[0];
}
MinType13379!T min13379(T...)(T args)   // #4 MinType!uint (speculative && thist == ShiftOr!char)
{
    alias a = args[0];
    alias b = args[$-1];
    return cast(typeof(return)) (a < b ? a : b);
}

/******************************************/
// 13417

struct V13417(size_t N, E, alias string AS)
{
}

auto f13417(E)(in V13417!(4, E, "ijka"))
{
    return V13417!(3, E, "xyz")();
}

void test13417()
{
    f13417(V13417!(4, float, "ijka")());
}

/******************************************/
// 13484

int foo13484()(void delegate() hi) { return 1; }
int foo13484(T)(void delegate(T) hi) { return 2; }

void test13484()
{
    assert(foo13484({}) == 1);          // works
    assert(foo13484((float v){}) == 2); // works <- throws error
}

/******************************************/
// 13675

enum E13675;

bool foo13675(T : E13675)()
{
    return false;
}

void test13675()
{
    if (foo13675!E13675)
    {}
}

/******************************************/
// 13694

auto foo13694(T)(string A,         T[] G ...) { return 1; }
auto foo13694(T)(string A, long E, T[] G ...) { return 2; }

void test13694()
{
    struct S {}

    S v;
    assert(foo13694("A", v) == 1);      // <- OK
    assert(foo13694("A", 0, v) == 2);   // <- used to be OK but now fails
    assert(foo13694!S("A", 0, v) == 2); // <- workaround solution
}

/******************************************/
// 13760

void test13760()
{
    void func(K, V)(inout(V[K]) aa, inout(V) val) {}

    class C {}
    C[int] aa;
    func(aa, new C);
}

/******************************************/
// 13714

struct JSONValue13714
{
    this(T)(T arg)
    {
    }
    this(T : JSONValue13714)(inout T arg) inout
    {
        //store = arg.store;
    }

    void opAssign(T)(T arg)
    {
    }
}

void test13714()
{
    enum DummyStringEnum
    {
        foo = "bar"
    }

    JSONValue13714[string] aa;
    aa["A"] = DummyStringEnum.foo;
}

/******************************************/
// 13807

T f13807(T)(inout(T)[] arr)
{
    return T.init;
}

void test13807()
{
    static assert(is(typeof(f13807([1, 2, 3])) == int));    // OK
    static assert(is(typeof(f13807(["a", "b"])) == string));    // OK <- Error
    static assert(is(typeof(f13807!string(["a", "b"])) == string)); // OK
}

/******************************************/
// 14174

struct Config14174(a, b) {}

struct N14174 {}

alias defConfig14174 = Config14174!(N14174, N14174);

void accepter14174a(Config : Config14174!(T) = defConfig14174, T...)()
{
    static assert(accepter14174a.mangleof
        == "_D7breaker131__T14"~
           "accepter14174a"~
           "HTS7breaker51__T11Config14174TS7breaker6N14174TS7breaker6N14174Z11Config14174TS7breaker6N14174TS7breaker6N14174Z14"~
           "accepter14174a"~
           "FZv");
}

void accepter14174b(Config : Config14174!(T) = defConfig14174, T...)()
{
    static assert(accepter14174b.mangleof
        == "_D7breaker131__T14"~
           "accepter14174b"~
           "HTS7breaker51__T11Config14174TS7breaker6N14174TS7breaker6N14174Z11Config14174TS7breaker6N14174TS7breaker6N14174Z14"~
           "accepter14174b"~
           "FZv");
}

void test14174()
{
    accepter14174a!()(); // ok
    accepter14174b();    // error
}

/******************************************/
// 14836

template a14836x(alias B, C...)
{
    int a14836x(D...)()    if (D.length == 0) { return 1; }
    int a14836x(D...)(D d) if (D.length >  0) { return 2; }
}
template a14836y(alias B, C...)
{
    int a14836y(T, D...)(T t)      if (D.length == 0) { return 1; }
    int a14836y(T, D...)(T t, D d) if (D.length >  0) { return 2; }
}

void test14836()
{
    int v;
    assert(a14836x!(v)() == 1);
    assert(a14836x!(v)(1) == 2);
    assert(a14836y!(v)(1) == 1);
    assert(a14836y!(v)(1, 2) == 2);
}

/******************************************/
// 14357

template Qux14357(T : U*, U : V*, V)
{
    pragma(msg, T);     // no match <- float**
    pragma(msg, U);     // no match <- float*
    pragma(msg, V);     // no match <- int
    enum Qux14357 = T.sizeof + V.sizeof;
}
static assert(!__traits(compiles, Qux14357!(float**, int*)));

/******************************************/
// 14481

template someT14481(alias e)
{
    alias someT14481 = e;
}

mixin template Mix14481(alias e)
{
    alias SomeAlias = someT14481!e;
}

struct Hoge14481
{
    mixin Mix14481!e;
    enum e = 10;
}

/******************************************/
// 14520

template M14520(alias  a) { enum M14520 = 1; }
template M14520(string s) { enum M14520 = 2; }

int f14520a();
string f14520b() { assert(0); }
string f14520c() { return "a"; }

static assert(M14520!f14520a == 1);
static assert(M14520!f14520b == 1);
static assert(M14520!f14520c == 1);

/******************************************/
// 14568

struct Interval14568()
{
    auto left = INVALID;

    auto opAssign()(Interval14568) { left; }
}

auto interval14568(T)(T point)
{
    Interval14568!();
}

alias Instantiate14568(alias symbol, Args...) = symbol!Args;

template Match14568(patterns...)
{
    static if (__traits(compiles, Instantiate14568!(patterns[0])))
    {
        alias Match14568 = patterns[0];
    }
    else static if (patterns.length == 1)
    {}
}

template SubOps14568(Args...)
{
    auto opIndex()
    {
        template IntervalType(T...)
        {
            alias Point() = typeof(T.interval14568);

            alias IntervalType = Match14568!(Point);
        }
        alias Subspace = IntervalType!(Args);
    }
}

struct Nat14568 { mixin SubOps14568!(null); }

/******************************************/
// 14603, 14604

struct S14603
{
    template opDispatch(string name)
    {
        void opDispatch()() {}
    }
}
alias a14603 = S14603.opDispatch!"go";  // OK
alias b14603 = S14603.go;               // OK <- NG

struct S14604
{
    template opDispatch(string name)
    {
        void opDispatch()() {}
    }
}
alias Id14604(alias thing) = thing;
alias c14604 = Id14604!(S14604.opDispatch!"go");     // ok
alias d14604 = Id14604!(S14604.go);                  // issue 14604, 'Error: template instance opDispatch!"go" cannot resolve forward reference'

/******************************************/
// 14735

enum CS14735 { yes, no }

int indexOf14735a(Range      )(Range    s, in dchar c) { return 1; }
int indexOf14735a(T, size_t n)(ref T[n] s, in dchar c) { return 2; }

int indexOf14735b(Range      )(Range    s, in dchar c, in CS14735 cs = CS14735.yes) { return 1; }
int indexOf14735b(T, size_t n)(ref T[n] s, in dchar c, in CS14735 cs = CS14735.yes) { return 2; }

void test14735()
{
    char[64] buf;

    // Supported from 2.063: (http://dlang.org/changelog#implicitarraycast)
    assert(indexOf14735a(buf[0..32], '\0') == 2);
    assert(indexOf14735b(buf[0..32], '\0') == 2);

    // Have to work as same as above.
    assert(indexOf14735a(buf[], '\0') == 2);
    assert(indexOf14735b(buf[], '\0') == 2);
}

/******************************************/
// 14743

class A14743
{
    auto func1 = (A14743 a) { a.func2!int(); };
    auto func2(T)() {}
}

/******************************************/
// 14802

void test14802()
{
    auto func(T)(T x, T y) { return x; }

    struct S1 { double x; alias x this; }
    struct S2 { double x; alias x this; }
    S1 s1;
    S2 s2;

    enum E1 : double { a = 1.0 }
    enum E2 : double { a = 1.0 }

    static assert(is(typeof( func(1 , 1 ) ) == int));
    static assert(is(typeof( func(1u, 1u) ) == uint));
    static assert(is(typeof( func(1u, 1 ) ) == uint));
    static assert(is(typeof( func(1 , 1u) ) == uint));

    static assert(is(typeof( func(1.0f, 1.0f) ) == float));
    static assert(is(typeof( func(1.0 , 1.0 ) ) == double));
    static assert(is(typeof( func(1.0 , 1.0f) ) == double));
    static assert(is(typeof( func(1.0f, 1.0 ) ) == double));

    static assert(is(typeof( func(s1, s1) ) == S1));
    static assert(is(typeof( func(s2, s2) ) == S2));
    static assert(is(typeof( func(s1, s2) ) == double));
    static assert(is(typeof( func(s2, s1) ) == double));

    static assert(is(typeof( func(E1.a, E1.a) ) == E1));
    static assert(is(typeof( func(E2.a, E2.a) ) == E2));
    static assert(is(typeof( func(E1.a, 1.0)  ) == double));
    static assert(is(typeof( func(E2.a, 1.0)  ) == double));
    static assert(is(typeof( func(1.0,  E1.a) ) == double));
    static assert(is(typeof( func(1.0,  E2.a) ) == double));
    static assert(is(typeof( func(E1.a, E2.a) ) == double));
    static assert(is(typeof( func(E2.a, E1.a) ) == double));
}

/******************************************/
// 14886

void test14886()
{
    alias R = int[100_000];

    auto front(T)(T[] a) {}
    front(R.init);

    auto bar1(T)(T, T[] a) { return T.init; }
    auto bar2(T)(T[] a, T) { return T.init; }

    static assert(is(typeof(bar1(1L, R.init)) == long));
    static assert(is(typeof(bar2(R.init, 1L)) == long));
    // <-- T should be deduced to int because R.init is rvalue...?

    ubyte x;
    static assert(is(typeof(bar1(x, R.init)) == int));
    static assert(is(typeof(bar2(R.init, x)) == int));
}

/******************************************/
// 15156

// 15156
auto f15116a(T)(string s, string arg2) { return 1; }
auto f15116b(T)(int    i, string arg2) { return 2; }

template bish15116(T)
{
    alias bish15116 = f15116a!T;
    alias bish15116 = f15116b!T;
}

void test15116()
{
    alias func = bish15116!string;
    assert(func("", "") == 1);
    assert(func(12, "") == 2);
}

/******************************************/
// 15152

void test15152()
{
    void func(string M)() { }

    struct S
    {
        enum name = "a";
    }

    enum s = S.init;
    func!(s.name);
}

/******************************************/
// 15352

struct S15352(T, T delegate(uint idx) supplier)
{
}

auto make15352a(T, T delegate(uint idx) supplier)()
{
    enum local = supplier;      // OK
    S15352!(T, local) ret;
    return ret;
}

auto make15352b(T, T delegate(uint idx) supplier)()
{
    S15352!(T, supplier) ret;   // OK <- Error
    return ret;
}

void test15352()
{
    enum dg = delegate(uint idx) => idx;
    auto s1 = S15352!(uint, dg)();
    auto s2 = make15352a!(uint, dg)();
    auto s3 = make15352b!(uint, dg)();
    assert(is(typeof(s1) == typeof(s2)));
    assert(is(typeof(s1) == typeof(s3)));
}

/******************************************/
// 15623

struct WithFoo15623a { void foo() {} }
struct WithFoo15623b { void foo() {} }
struct WithFoo15623c { void foo() {} }
struct WithFoo15623d { void foo() {} }

struct WithoutFoo15623a {}
struct WithoutFoo15623b {}
struct WithoutFoo15623c {}
struct WithoutFoo15623d {}

struct CallsFoo15623(T)
{
    T t;
    void bar() { t.foo(); }     // error occurs during TemplateInstance.semantic3
}

// Instantiations outside of function bodies
static assert( is(CallsFoo15623!WithFoo15623a));
static assert(!is(CallsFoo15623!WithoutFoo15623a));                     // OK <- NG
static assert( __traits(compiles, CallsFoo15623!WithFoo15623b));
static assert(!__traits(compiles, CallsFoo15623!WithoutFoo15623b));     // OK <- NG

// Instantiations inside function bodies (OK)
static assert( is(typeof({ alias Baz = CallsFoo15623!WithFoo15623c; return Baz.init; }())));
static assert(!is(typeof({ alias Baz = CallsFoo15623!WithoutFoo15623c; return Baz.init; }())));
static assert( __traits(compiles, { alias Baz = CallsFoo15623!WithFoo15623d; return Baz.init; }()));
static assert(!__traits(compiles, { alias Baz = CallsFoo15623!WithoutFoo15623d; return Baz.init; }()));

/******************************************/
// 15781

void test15781()
{
    static struct S
    {
        int value;
    }

    T foo(T)(T a, T b)
    {
        return T();
    }

    const S cs;
          S ms;
    static assert(is(typeof(foo(ms, ms)) ==       S));
    static assert(is(typeof(foo(ms, cs)) == const S));
    static assert(is(typeof(foo(cs, ms)) == const S));
    static assert(is(typeof(foo(cs, cs)) == const S));
}

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

int main()
{
    test1();
    test2();
    test3();
    test4();
    test5();
    test6();
    test7();
    test8();
    test9();
    test1780();
    test3608();
    test5893();
    test6404();
    test2246();
    test2296();
    bug4984();
    test2579();
    test2803();
    test6613();
    test5886();
    test5393();
    test5896();
    test6825();
    test6789();
    test2778();
    test2778aa();
    test2778get();
    test6208a();
    test6208b();
    test6208c();
    test6738();
    test6780();
    test6810();
    test6891();
    test6994();
    test6764();
    test3467();
    test4413();
    test5525();
    test5801();
    test10();
    test7037();
    test7124();
    test7359();
    test7416();
    test7563();
    test7572();
    test7580();
    test7585();
    test7671();
    test7672();
    test7684();
    test11a();
    test11b();
    test7769();
    test7873();
    test7933();
    test8094();
    test12();
    test8125();
    test13();
    test14();
    test8129();
    test8238();
    test8669();
    test8833();
    test8976();
    test8940();
    test9022();
    test9026();
    test9038();
    test9076();
    test9100();
    test9124a();
    test9124b();
    test9143();
    test9266();
    test9536();
    test9578();
    test9596();
    test9837();
    test9874();
    test9885();
    test9971();
    test9977();
    test10083();
    test10592();
    test11242();
    test10811();
    test10969();
    test11271();
    test11533();
    test11818();
    test11843();
    test11872();
    test12122();
    test12207();
    test12376();
    test13235();
    test13294();
    test13299();
    test13374();
    test13378();
    test13379();
    test13484();
    test13694();
    test14836();
    test14735();
    test14802();
    test15116();

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