diff options
author | Vladimir Kalinin <vkalinin@opendesign.com> | 2013-12-16 13:08:34 +0400 |
---|---|---|
committer | Vladimir Kalinin <vkalinin@opendesign.com> | 2013-12-16 13:08:34 +0400 |
commit | 5487345ce7ff484f9313e1ae6e65d754c47f1efa (patch) | |
tree | 94eb6931e66800fef426aff748270753ff0fb450 /Source | |
parent | 865408874f3b6a392fe5fda7d5102deeb53ade06 (diff) | |
download | swig-5487345ce7ff484f9313e1ae6e65d754c47f1efa.tar.gz |
properly disabled nested %template declared in other scopes
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CParse/parser.y | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index d2fa06f72..ef5aa6ef4 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -2675,7 +2675,8 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va } else { Setattr(templnode,"sym:typename","1"); } - if ($3) { + /* for now, nested %template is allowed only in the same scope as the template declaration */ + if ($3 && !(currentOuterClass && (currentOuterClass != Getattr(nn, "nested:outer")))) { /* Comment this out for 1.3.28. We need to re-enable it later but first we need to @@ -2694,6 +2695,9 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va Setattr(templnode,"sym:name",nname); Delete(nname); Setattr(templnode,"feature:onlychildren", "typemap,typemapitem,typemapcopy,typedef,types,fragment"); + if ($3) { + Swig_warning(WARN_PARSE_NESTED_TEMPLATE, cparse_file, cparse_line, "Named nested template instantiations not supported. Processing as if no name was given to %%template().\n"); + } } Delattr(templnode,"templatetype"); Setattr(templnode,"template",nn); @@ -2704,9 +2708,6 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va SetFlag(templnode, "nested"); Setattr(templnode, "nested:outer", currentOuterClass); } - else - Delattr(templnode, "nested:outer"); - add_symbols_copy(templnode); if (Strcmp(nodeType(templnode),"class") == 0) { |