Added C++0x support for 'extern' explicit template instantiation without the translation unit.

Added test cases.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@11385 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Matevz Jekovec 2009-07-11 20:13:36 +00:00
commit e1b5d43cd8
7 changed files with 14 additions and 9 deletions

View file

@ -403,7 +403,8 @@ CPP0X_TEST_CASES = \
cpp0x_template_double_brackets \
cpp0x_explicit_conversion_operators \
cpp0x_raw_string_literals \
cpp0x_static_assert
cpp0x_static_assert \
cpp0x_template_explicit
# cpp0x_constexpr # not supported by any compilers yet
# Broken C++0x test cases.

View file

@ -1,10 +1,11 @@
/* This interface tests whether Swig supports the new "constexpr" keyword
introduced by C++0x.
*/
%module foo
%module cpp0x_constexpr
%inline %{
class TestClass {
public:
constexpr int func() { return 10; }
};
%}

View file

@ -1,7 +1,7 @@
/* This interface checks whether Swig correctly compiles the new
explicit conversion operators feature introduced in C++0x.
*/
%module foo
%module cpp0x_explicit_conversion_operators
%inline %{

View file

@ -7,8 +7,7 @@
This module also tests whether Swig correctly parses custom string delimiters.
*/
%module raw_string_literals
%module cpp0x_raw_string_literals
%inline %{
#include <iostream>

View file

@ -1,7 +1,7 @@
/* This test case checks whether swig correctly parses and ignores the
keywords "static_assert()" inside the class or struct.
*/
%module static_assert
%module cpp0x_static_assert
%inline %{
template <typename T>

View file

@ -2,7 +2,7 @@
in the template syntax without having a space inbetween. This feature was
introduced in new C++0x standard.
*/
%module foo
%module cpp0x_template_double_brackets
%inline %{
#include <map>
std::map<int,std::map<int, double>> m;

View file

@ -3850,10 +3850,14 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
if (error) $$ = 0;
}
| TEMPLATE cpptype idcolon {
| TEMPLATE cpptype idcolon { /* Explicit template instantiation */
Swig_warning(WARN_PARSE_EXPLICIT_TEMPLATE, cparse_file, cparse_line, "Explicit template instantiation ignored.\n");
$$ = 0;
}
}
| EXTERN TEMPLATE cpptype idcolon { /* Explicit template instantiation without the translation unit */
Swig_warning(WARN_PARSE_EXPLICIT_TEMPLATE, cparse_file, cparse_line, "Explicit template instantiation ignored.\n");
$$ = 0;
}
;
cpp_temp_possible: c_decl {