Question: This question was at the interview:
*Does this code causes any compile/linking errors and why so?*

```
template <int T> void f();
template <> void f<0>() {}

void test() 
{
    f<1>();
}

```

Please explain the behaviour. Thanks a lot.

Answer: 
```
template<> void f<0>() {}

```

is specialization of function template for argument `0`, if you call `f<0>()` this version of function will be called.

This code is incorrect, it cause linking errors, since there is no specialization for `f<1>` and template version of function is not `defined`.
It will compile (all the code is gramatically valid) but will fail at link stage.

This is because `template <int T> void f();` is declared but *not* defined, the <0> specialisation *is* defined but that makes no odds to you since you're not instantiating it.

Actually, it *would* be possible for the <0> specialisation to contain syntax errors and the program *would* still compile without error! This is because formally, templates are only compiled if they are used. (I wouldn't expect a candidate to have the presence of mind during interview conditions to point that out.)