Add support for c++11 strongly typed enums inheriting from non standard primitive types
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13012 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
fdb9f072a7
commit
6f9312d1c1
2 changed files with 30 additions and 1 deletions
|
|
@ -49,4 +49,33 @@ enum class Enum5 {
|
|||
enum class Enum6 : unsigned int {
|
||||
Val1, Val2, Val3 = 300, Val4
|
||||
};
|
||||
|
||||
typedef enum class Enum7 : unsigned int {
|
||||
Val1, Val2, Val3 = 300, Val4
|
||||
} Enum7td;
|
||||
|
||||
// enum inherits from non-primitive type
|
||||
enum class Enum8 : size_t {
|
||||
Val1, Val2, Val3 = 300, Val4
|
||||
};
|
||||
|
||||
template <typename T> struct TType {
|
||||
typedef T type_name;
|
||||
};
|
||||
|
||||
enum class Enum10 : TType<int>::type_name {
|
||||
Val1, Val2, Val3 = 300, Val4
|
||||
};
|
||||
|
||||
/*
|
||||
TODO
|
||||
enum class MyClass {AAA, BBB, CCC};
|
||||
namespace Space {
|
||||
enum MyEnum {XXX, YYY, ZZZ};
|
||||
}
|
||||
struct SSS {
|
||||
MyClass m;
|
||||
};
|
||||
*/
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -3319,7 +3319,7 @@ c_enum_keyword : ENUM {
|
|||
base enum type (eg. unsigned short)
|
||||
------------------------------------------------------------ */
|
||||
|
||||
c_enum_inherit : COLON primitive_type {
|
||||
c_enum_inherit : COLON type_right {
|
||||
$$ = $2;
|
||||
}
|
||||
| empty { $$ = 0; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue