Added syntax support for template aliasing and new 'using' syntax for typedefs introduced in C++0x.

Added testcase cpp0x_template_typedefs.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@11533 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Matevz Jekovec 2009-08-11 18:27:33 +00:00
commit 65c09323fc
3 changed files with 21 additions and 0 deletions

View file

@ -413,6 +413,7 @@ CPP0X_TEST_CASES = \
cpp0x_alternate_function_syntax \
cpp0x_userdefined_literals \
cpp0x_decltype
# cpp0x_template_typedefs # not supported by any compiler yet
# cpp0x_hash_types # not fully implemented yet
# cpp0x_constructors # not supported by any compiler yet
# cpp0x_lambda_functions # not supported by GCC or MSVC yet

View file

@ -0,0 +1,18 @@
/* This testcase checks whether Swig correctly parses the template aliasing. */
%module cpp0x_template_typedefs
%inline %{
template< typename T1, typename T2, int >
class SomeType {
T1 a;
T2 b;
int c;
};
template< typename T2 >
using TypedefName = SomeType<char*, T2, 5>;
typedef void (*PFD)(double); // Old style
using PF = void (*)(double); // New introduced syntax
%}

View file

@ -2942,6 +2942,8 @@ c_declaration : c_decl {
}
}
| c_lambda_decl { Swig_warning(WARN_LANG_NATIVE_UNIMPL, cparse_file, cparse_line,"Swig doesn't produce wrapper code for lambda expressions and closures yet.\n"); $$ = $1; }
| USING idcolon EQUAL { skip_decl(); Swig_warning(WARN_LANG_NATIVE_UNIMPL, cparse_file, cparse_line,"Swig doesn't support 'using' typedefs yet.\n"); $$ = 0; }
| TEMPLATE LESSTHAN template_parms GREATERTHAN USING idcolon EQUAL { skip_decl(); Swig_warning(WARN_LANG_NATIVE_UNIMPL, cparse_file, cparse_line,"Swig doesn't support template aliasing yet.\n"); $$ = 0; }
;
/* ------------------------------------------------------------