/* This testcase checks whether SWIG correctly parses alias templates. */ %module cpp11_template_typedefs %warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) TypedefName; %warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) TypedefNamePtr; %warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) MyIntKeyClass; %warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) PF; %warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) BucketAllocator1; %warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) BucketAllocator2; // This warning should go away when type aliasing is supported #pragma SWIG nowarn=SWIGWARN_PARSE_USING_UNDEF // Nothing known about 'p.SomeType< char *,T2,4 >'. %inline %{ template< typename T1, typename T2, int > class SomeType { T1 a; T2 b; int c; }; // template aliasing template< typename T2 > using TypedefName = SomeType; template< typename T2 > using TypedefNamePtr = SomeType*; // type aliasing typedef void (*PFD)(double); // Old style using PF = void (*)(double); // New introduced syntax // use of template aliasing template class MyCPP11Class { }; template using MyIntKeyClass = MyCPP11Class; MyIntKeyClass intchar; TypedefName alias1(TypedefName a) { return a; } TypedefNamePtr alias1(TypedefNamePtr a = nullptr) { return a; } %} %inline %{ typedef double Val; template struct ListBucket { }; namespace Alloc { template struct rebind { typedef int other; }; } using BucketAllocator1 = typename Alloc::template rebind>::other; using BucketAllocator2 = typename Alloc::template rebind<::template ListBucket>::other; %}