1 module test1673;
2
Foo(T...)3 template Foo(T...) { }
4
Bar(T...)5 template Bar(T...)
6 {
7 template Doo(T...)
8 {
9 }
10 }
11
Tuple(T...)12 template Tuple(T...) { alias Tuple = T; }
13
main()14 void main()
15 {
16 static assert( __traits(isTemplate, Foo));
17 static assert(!__traits(isTemplate, Foo!int));
18 static assert(!__traits(isTemplate, main));
19
20 static assert( __traits(isTemplate, Bar));
21 static assert(!__traits(isTemplate, Bar!int));
22 static assert( __traits(isTemplate, Bar!(int).Doo));
23 static assert(!__traits(isTemplate, Bar!(int).Doo!int));
24
25 alias Tup = Tuple!(Foo, Foo!int, Bar, Bar!int, Bar!(int).Doo, Bar!(int).Doo!int);
26
27 static assert( __traits(isTemplate, Tup[0]));
28 static assert(!__traits(isTemplate, Tup[1]));
29 static assert( __traits(isTemplate, Tup[2]));
30 static assert(!__traits(isTemplate, Tup[3]));
31 static assert( __traits(isTemplate, Tup[4]));
32 static assert(!__traits(isTemplate, Tup[5]));
33 }
34
35 /// test overloads
foo_over()36 void foo_over() { }
37 void foo_over(T : int)(T) { }
38 void foo_over(T : float)(T) { }
39 static assert(__traits(isTemplate, foo_over));
40
41 /// ditto
bar_over()42 void bar_over() { }
bar_over(int)43 void bar_over(int) { }
44 static assert(!__traits(isTemplate, bar_over));
45
46 /// alias to overloads
47 alias a_foo_over = foo_over;
48 static assert(__traits(isTemplate, a_foo_over));
49
50 /// ditto
51 alias a_bar_over = bar_over;
52 static assert(!__traits(isTemplate, a_bar_over));
53