mirror of https://github.com/swig/swig
Prevent "__dummy_0__" template methods from matching name warnings
This commit is contained in:
parent
de78b80de9
commit
307c9814a0
|
@ -69,3 +69,20 @@ namespace std
|
|||
#endif
|
||||
double bar(double native, bool boolean) { return 1.0; }
|
||||
}
|
||||
|
||||
// Test that anonymous template instantiations are ignored from
|
||||
// %rename/%namewarn
|
||||
%namewarn(%warningmsg(SWIGWARN_LANG_IDENTIFIER, "incorrectly warning about non-wrapped instantiated template"), error=1) "__dummy_0__";
|
||||
%inline %{
|
||||
template<typename T> struct Foo {
|
||||
typedef T value_type;
|
||||
};
|
||||
%}
|
||||
%template() Foo<int>;
|
||||
|
||||
// But they should still generate the correct typemaps etc
|
||||
%inline %{
|
||||
int double_an_int(Foo<int>::value_type v) {
|
||||
return v * 2;
|
||||
}
|
||||
%}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
from name_warnings import *
|
||||
|
||||
four = double_an_int(2)
|
||||
assert four == 4
|
||||
|
|
@ -2970,6 +2970,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
String *nname = NewStringf("__dummy_%d__", cnt++);
|
||||
Swig_cparse_template_expand(templnode,nname,temparms,tscope);
|
||||
Setattr(templnode,"sym:name",nname);
|
||||
SetFlag(templnode,"hidden");
|
||||
Delete(nname);
|
||||
Setattr(templnode,"feature:onlychildren", "typemap,typemapitem,typemapcopy,typedef,types,fragment,apply");
|
||||
if ($3) {
|
||||
|
|
Loading…
Reference in New Issue