Fix parsing of forward declaration of C++0x enums
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13010 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
368f442508
commit
fdb9f072a7
2 changed files with 19 additions and 9 deletions
|
|
@ -7,6 +7,12 @@
|
|||
%warnfilter(302) Val3;
|
||||
%warnfilter(302) Val4;
|
||||
|
||||
/* Forward declarations (illegally accepted by SWIG - oh well!) */
|
||||
enum Enum1 : short;
|
||||
enum Enum3;
|
||||
enum ;
|
||||
enum : unsigned short;
|
||||
|
||||
%inline %{
|
||||
enum class Enum1 {
|
||||
Val1,
|
||||
|
|
@ -21,13 +27,16 @@ enum class Enum2 : short {
|
|||
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.
|
||||
// SWIG should fail this one
|
||||
enum Enum2 : unsigned short; // Illegal in C++0x, because Enum2 was previously declared with a different type.
|
||||
|
||||
%inline %{
|
||||
/* Forward declarations. */
|
||||
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 Enum4 : unsigned int {
|
||||
Val1, Val2, Val3 = 100, Val4
|
||||
|
|
|
|||
|
|
@ -3326,14 +3326,15 @@ c_enum_inherit : COLON primitive_type {
|
|||
;
|
||||
/* ------------------------------------------------------------
|
||||
enum [class] Name;
|
||||
enum [class] Name [: base_type];
|
||||
------------------------------------------------------------ */
|
||||
|
||||
c_enum_forward_decl : storage_class c_enum_keyword c_enum_inherit ID SEMI {
|
||||
c_enum_forward_decl : storage_class c_enum_keyword ename c_enum_inherit SEMI {
|
||||
SwigType *ty = 0;
|
||||
$$ = new_node("enumforward");
|
||||
ty = NewStringf("enum %s", $4);
|
||||
ty = NewStringf("enum %s", $3);
|
||||
Setattr($$,"enumkeyword",$2);
|
||||
Setattr($$,"name",$4);
|
||||
Setattr($$,"name",$3);
|
||||
Setattr($$,"type",ty);
|
||||
Setattr($$,"sym:weak", "1");
|
||||
add_symbols($$);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue