Added constexpr keywords and CONSTEXPR terminal to Swig parser.
Added cpp0x_constexpr.i testcase. Fixed compilation bug of cpp0x_template_double_brackets.i testcase. Removed obsolete cpp0x_template_double_brackets_broken. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@11322 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5fd3ccae18
commit
d8012716ed
6 changed files with 22 additions and 37 deletions
|
|
@ -93,6 +93,7 @@ C_TEST_BROKEN += \
|
|||
|
||||
# C++ test cases. (Can be run individually using make testcase.cpptest.)
|
||||
CPP_TEST_CASES += \
|
||||
$(CPP0X_TEST_CASES) \
|
||||
abstract_access \
|
||||
abstract_inherit \
|
||||
abstract_inherit_ok \
|
||||
|
|
@ -395,16 +396,15 @@ CPP_TEST_CASES += \
|
|||
virtual_destructor \
|
||||
virtual_poly \
|
||||
voidtest \
|
||||
wrapmacro \
|
||||
$(CPP0X_TEST_CASES)
|
||||
wrapmacro
|
||||
|
||||
# C++0x test cases.
|
||||
CPP0X_TEST_CASES = \
|
||||
cpp0x_template_double_brackets
|
||||
# cpp0x_constexpr # not supported by any compilers yet
|
||||
|
||||
# Broken C++0x test cases.
|
||||
CPP0X_TEST_BROKEN = \
|
||||
cpp0x_template_double_brackets_broken
|
||||
CPP0X_TEST_BROKEN =
|
||||
|
||||
#
|
||||
# Put all the heavy STD/STL cases here, where they can be skipped if needed
|
||||
|
|
@ -497,7 +497,7 @@ ALL_CLEAN = $(CPP_TEST_CASES:=.clean) \
|
|||
#######################################################################
|
||||
# The following applies for all module languages
|
||||
#######################################################################
|
||||
all: $(BROKEN_TEST_CASES) $(NOT_BROKEN_TEST_CASES)
|
||||
all: $(NOT_BROKEN_TEST_CASES) $(BROKEN_TEST_CASES)
|
||||
|
||||
check: $(NOT_BROKEN_TEST_CASES)
|
||||
|
||||
|
|
|
|||
8
Examples/test-suite/cpp0x_constexpr.i
Normal file
8
Examples/test-suite/cpp0x_constexpr.i
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
%module foo
|
||||
|
||||
%inline %{
|
||||
class TestClass {
|
||||
constexpr int func() { return 10; }
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
%module foo
|
||||
%inline %{
|
||||
#include <map>
|
||||
std::map<int,std::map<int, double>> m;
|
||||
std::map<int,std::map<int, double> > n;
|
||||
std::map< std::map<(6>>1), double>, double> o;
|
||||
//std::map< std::map<6>>1, double>, double> p; // fails as it should
|
||||
std::map< int,std::map<int, double> > n;
|
||||
|
||||
class ABC {
|
||||
public:
|
||||
|
|
@ -18,9 +17,10 @@ public:
|
|||
int a;
|
||||
|
||||
template<typename U>
|
||||
int operator>>(ABC &, U);
|
||||
U operator>>(ABC &);
|
||||
|
||||
template<typename U>
|
||||
int operator<<(ABC &, U);
|
||||
U operator<<(ABC &);
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
%module foo
|
||||
#include <map>
|
||||
std::map<int,std::map<int, double>> m;
|
||||
std::map<int,std::map<int, double> > n;
|
||||
std::map< std::map<(6>>1), double>, double> o;
|
||||
std::map< std::map<6>>1, double>, double> p; // fails as it should
|
||||
|
||||
class ABC {
|
||||
public:
|
||||
int a;
|
||||
int operator>>(ABC &);
|
||||
int operator<<(ABC &);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class ABC2 {
|
||||
public:
|
||||
int a;
|
||||
|
||||
template<typename U>
|
||||
int operator>>(ABC &, U);
|
||||
|
||||
template<typename U>
|
||||
int operator<<(ABC &, U);
|
||||
};
|
||||
|
||||
|
|
@ -630,6 +630,8 @@ int yylex(void) {
|
|||
return (PROTECTED);
|
||||
if (strcmp(yytext, "friend") == 0)
|
||||
return (FRIEND);
|
||||
if (strcmp(yytext, "constexpr") == 0)
|
||||
return (CONSTEXPR);
|
||||
if (strcmp(yytext, "virtual") == 0)
|
||||
return (VIRTUAL);
|
||||
if (strcmp(yytext, "operator") == 0) {
|
||||
|
|
|
|||
|
|
@ -1492,7 +1492,7 @@ static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) {
|
|||
%token ILLEGAL CONSTANT
|
||||
%token NAME RENAME NAMEWARN EXTEND PRAGMA FEATURE VARARGS
|
||||
%token ENUM
|
||||
%token CLASS TYPENAME PRIVATE PUBLIC PROTECTED COLON STATIC VIRTUAL FRIEND THROW CATCH EXPLICIT
|
||||
%token CLASS TYPENAME PRIVATE PUBLIC PROTECTED COLON STATIC VIRTUAL FRIEND THROW CATCH EXPLICIT CONSTEXPR
|
||||
%token USING
|
||||
%token <node> NAMESPACE
|
||||
%token NATIVE INLINE
|
||||
|
|
@ -4490,6 +4490,7 @@ storage_class : EXTERN { $$ = "extern"; }
|
|||
| VIRTUAL { $$ = "virtual"; }
|
||||
| FRIEND { $$ = "friend"; }
|
||||
| EXPLICIT { $$ = "explicit"; }
|
||||
| CONSTEXPR { $$ = "constexpr"; }
|
||||
| empty { $$ = 0; }
|
||||
;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue