AFAICS the following code should compile. template<int a> struct foo { struct barney { template<int c> void bar() { } }; void baz() { barney b; b.bar<0>(); // (This is line 15.) } }; Comeau's online compiler compiles this snippet just fine. GCC 3.3.2 gives me: gcc test.cc test.cc: In member function `void foo<a>::baz()': test.cc:15: error: parse error before `;' token
No, this is invalid code. The type of b is template dependent, so you need to use the following syntax (which does compile with gcc): b.template bar<0>(); // (This is line 15.) W.