%module template_keyword_in_type %warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) YYY; %inline %{ template struct XXX; template struct XXX { template struct YYY { typedef TT type; }; int xxx(int h) { return h; } }; #if defined(SWIG) || defined(__clang__) // gcc doesn't parse this (tested with gcc-4.8) template void testXXX1(::template XXX::template YYY::type xx) {} #else template void testXXX1(:: XXX::template YYY::type xx) {} #endif template void testXXX2(XXX::YYY::type xx) {} template void testXXX3(::XXX::template YYY::type) {} %} %inline %{ typedef double Val; template struct ListBucket { }; namespace Alloc { template struct rebind { typedef int other; }; } template void other1(typename Alloc::template rebind >::other) {} #if !defined(__SUNPRO_CC) template void other2(typename Alloc::template rebind< ::template ListBucket >::other) {} #else template void other2(typename Alloc::template rebind< :: ListBucket >::other) {} #endif template void other3(Alloc::template rebind) {} %}