| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail213.d(18): Error: template instance `Foo!int` does not match template declaration `Foo(T : immutable(T))` |
| 5 |
fail_compilation/fail213.d(25): Error: template instance `Foo!(const(int))` does not match template declaration `Foo(T : immutable(T))` |
| 6 |
--- |
| 7 |
*/ |
| 8 |
|
| 9 |
template Foo(T:immutable(T)) |
| 10 |
{ |
| 11 |
alias T Foo; |
| 12 |
} |
| 13 |
|
| 14 |
void main() |
| 15 |
{ |
| 16 |
{ |
| 17 |
int x; |
| 18 |
alias Foo!(typeof(x)) f; |
| 19 |
//printf("%s\n", typeid(f).toString().ptr); |
| 20 |
assert(is(typeof(x) == int)); |
| 21 |
assert(is(f == int)); |
| 22 |
} |
| 23 |
{ |
| 24 |
const int x; |
| 25 |
alias Foo!(typeof(x)) f; |
| 26 |
} |
| 27 |
} |