C++11 alias templates seg fault fix

Segfault fix when using alias templates, reported by Pierre-Henri Wuillemin
This commit is contained in:
William S Fulton 2013-12-03 23:24:17 +00:00
commit b175df4e5f
2 changed files with 11 additions and 3 deletions

View file

@ -2,6 +2,7 @@
%module cpp11_template_typedefs
%warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) TypedefName;
%warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) MyIntKeyClass;
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) PF;
%inline %{
@ -19,5 +20,13 @@ using TypedefName = SomeType<char*, T2, 5>;
// type aliasing
typedef void (*PFD)(double); // Old style
using PF = void (*)(double); // New introduced syntax
// use of template aliasing
template<typename Key,typename Val>
class MyCPP11Class {
};
template<typename VAL> using MyIntKeyClass = MyCPP11Class<int,VAL>;
MyIntKeyClass<char> intchar;
%}

View file

@ -3208,16 +3208,15 @@ c_declaration : c_decl {
$$ = 0; /* TODO - ignored for now */
}
| TEMPLATE LESSTHAN template_parms GREATERTHAN USING idcolon EQUAL {
| TEMPLATE LESSTHAN template_parms GREATERTHAN USING idcolon EQUAL ID {
skip_decl();
$$ = new_node("using");
Setattr($$,"uname",$8);
Setattr($$,"name",$6);
add_symbols($$);
SWIG_WARN_NODE_BEGIN($$);
Swig_warning(WARN_CPP11_ALIAS_TEMPLATE, cparse_file, cparse_line, "The 'using' keyword in template aliasing is not fully supported yet.\n");
SWIG_WARN_NODE_END($$);
$$ = 0; /* TODO - ignored for now */
}
;