diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2013-01-05 20:13:19 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2013-01-05 20:13:19 +0000 |
commit | 3f1d77ee0fb193f2bc455573015e8c8981f546e6 (patch) | |
tree | 59bd2cec1adbe4b1f3d8abe2f14e39b03eb4d08e | |
parent | 41ddc7b240e4357c372c0b4992562d8a795a8e3a (diff) | |
parent | 8e418d61e6414fe2659b647d609515e15c5fe495 (diff) | |
download | swig-3f1d77ee0fb193f2bc455573015e8c8981f546e6.tar.gz |
Merge branch 'SFbug1296' of https://github.com/ptomulik/swig into ptomulik-SFbug1296
-rw-r--r-- | Examples/test-suite/common.mk | 1 | ||||
-rw-r--r-- | Examples/test-suite/template_default_arg_virtual_destructor.i | 24 | ||||
-rw-r--r-- | Source/CParse/parser.y | 10 |
3 files changed, 25 insertions, 10 deletions
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index fc82752a0..ececf84fd 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -356,6 +356,7 @@ CPP_TEST_CASES += \ template_default \ template_default2 \ template_default_arg \ + template_default_arg_virtual_destructor \ template_default_class_parms \ template_default_class_parms_typedef \ template_default_inherit \ diff --git a/Examples/test-suite/template_default_arg_virtual_destructor.i b/Examples/test-suite/template_default_arg_virtual_destructor.i new file mode 100644 index 000000000..319d5b837 --- /dev/null +++ b/Examples/test-suite/template_default_arg_virtual_destructor.i @@ -0,0 +1,24 @@ +%module template_default_arg_virtual_destructor + +// SF bug #1296: +// virtual destructor in template class (template specification having +// default parameter(s)) triggers the warning "illegal destructor name" + +%inline %{ +struct A {}; + +template <class X, class T = int> + struct B + { + B(T const&) {} + virtual ~B() {} + }; +template <class X> + struct B<X,int> + { + B(int,int) {} // constructor specific to this partial specialization + virtual ~B() {} // "illegal destructor name" when ~B() is virtual + }; +%} +%template(B_AF) B<A,float>; +%template(B_A) B<A>; // this instantiation triggert the warning diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 0d7c65f85..e4f3d67b2 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -4472,17 +4472,7 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end { | VIRTUAL NOT idtemplate LPAREN parms RPAREN cpp_vend { String *name; - char *c = 0; $$ = new_node("destructor"); - /* Check for template names. If the class is a template - and the constructor is missing the template part, we - add it */ - if (Classprefix) { - c = strchr(Char(Classprefix),'<'); - if (c && !Strchr($3,'<')) { - $3 = NewStringf("%s%s",$3,c); - } - } Setattr($$,"storage","virtual"); name = NewStringf("%s",$3); if (*(Char(name)) != '~') Insert(name,0,"~"); |