1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// Build don't link: template <int i> class a { public : int k; template <int j> int f() const { return this->f<j-1>(); } int g() const { return f<i>(); }; }; template <> template <> int a<2>::f<0>() const { return 0; } int main() { a<2> x; return x.g(); }