Added initial support for parsing C++0x strongly typed enumerations.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@11449 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Matevz Jekovec 2009-07-25 16:48:30 +00:00
commit 29004c3fcf
3 changed files with 95 additions and 27 deletions

View file

@ -406,7 +406,8 @@ CPP0X_TEST_CASES = \
cpp0x_static_assert \
cpp0x_template_explicit \
cpp0x_uniform_initialization \
cpp0x_function_objects
cpp0x_function_objects \
cpp0x_strongly_typed_enumerations
# cpp0x_alternate_function_syntax # not fully implemented yet
# cpp0x_hash_types # not fully implemented yet
# cpp0x_unrestricted_unions # not supported by any compilers yet

View file

@ -0,0 +1,36 @@
%module cpp0x_strongly_typed_enumerations
%inline %{
enum class Enum1 {
Val1,
Val2,
Val3 = 100,
Val4 /* = 101 */
};
enum class Enum2 : short {
Val1,
Val2,
Val3 = 100,
Val4
};
/* Forward declarations. GCC doesn't support them */
//enum Enum3; // Illegal in C++ and C++0x; no size is explicitly specified.
//enum Enum4 : unsigned int; // Legal in C++0x.
//enum class Enum5; // Legal in C++0x, because enum class declarations have a default type of "int".
//enum class Enum6 : unsigned int; // Legal C++0x.
//enum Enum2 : unsigned short; // Illegal in C++0x, because Enum2 was previously declared with a different type.
enum Enum4 : unsigned int {
Val1, Val2, Val3 = 100, Val4
};
enum class Enum5 {
Val1, Val2, Val3 = 100, Val4
};
enum class Enum6 : unsigned int {
Val1, Val2, Val3 = 300, Val4
};
%}