mirror of https://github.com/swig/swig
Merge branch 'SFbug1296' of https://github.com/ptomulik/swig into ptomulik-SFbug1296
This commit is contained in:
commit
3f1d77ee0f
|
@ -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 \
|
||||
|
|
|
@ -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
|
|
@ -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,"~");
|
||||
|
|
Loading…
Reference in New Issue