Fixed template partial specialization argument expansion bug
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4650 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
30eaab00ed
commit
5f076c6540
2 changed files with 10 additions and 5 deletions
|
|
@ -1900,7 +1900,9 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
||||||
|
|
||||||
if (n && (Strcmp(nodeType(n),"template") == 0)) {
|
if (n && (Strcmp(nodeType(n),"template") == 0)) {
|
||||||
Parm *tparms = Getattr(n,"templateparms");
|
Parm *tparms = Getattr(n,"templateparms");
|
||||||
if (!tparms) specialized = 1;
|
if (!tparms) {
|
||||||
|
specialized = 1;
|
||||||
|
}
|
||||||
if (!specialized && ((ParmList_len($7) > ParmList_len(tparms)))) {
|
if (!specialized && ((ParmList_len($7) > ParmList_len(tparms)))) {
|
||||||
Swig_error(cparse_file, cparse_line, "Too many template parameters. Maximum of %d.\n", ParmList_len(tparms));
|
Swig_error(cparse_file, cparse_line, "Too many template parameters. Maximum of %d.\n", ParmList_len(tparms));
|
||||||
} else if (!specialized && ((ParmList_len($7) < ParmList_numrequired(tparms)))) {
|
} else if (!specialized && ((ParmList_len($7) < ParmList_numrequired(tparms)))) {
|
||||||
|
|
@ -2632,7 +2634,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para
|
||||||
while (p) {
|
while (p) {
|
||||||
for (i = 0; i < nargs; i++){
|
for (i = 0; i < nargs; i++){
|
||||||
pn = Getattr(p,"name");
|
pn = Getattr(p,"name");
|
||||||
if (Strcmp(pn,Getitem(tlist,i)) == 0) {
|
if (Strcmp(pn,SwigType_base(Getitem(tlist,i))) == 0) {
|
||||||
int j;
|
int j;
|
||||||
Parm *p1 = tp;
|
Parm *p1 = tp;
|
||||||
for (j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
|
|
|
||||||
|
|
@ -214,14 +214,14 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms) {
|
||||||
if (0) {
|
if (0) {
|
||||||
Parm *p = tparms;
|
Parm *p = tparms;
|
||||||
while (p) {
|
while (p) {
|
||||||
Printf(stdout,"tparm: '%s' '%s'\n", Getattr(p,"name"), Getattr(p,"value"));
|
Printf(stdout,"tparm: '%s' '%s' '%s'\n", Getattr(p,"name"), Getattr(p,"type"), Getattr(p,"value"));
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Printf(stdout,"targs = '%s'\n", templateargs);
|
/* Printf(stdout,"targs = '%s'\n", templateargs);
|
||||||
Printf(stdout,"rname = '%s'\n", rname);
|
Printf(stdout,"rname = '%s'\n", rname);
|
||||||
Printf(stdout,"tname = '%s'\n", tname); */
|
Printf(stdout,"tname = '%s'\n", tname); */
|
||||||
cparse_template_expand(n,tname, rname, templateargs, patchlist, typelist, cpatchlist);
|
cparse_template_expand(n,tname, rname, templateargs, patchlist, typelist, cpatchlist);
|
||||||
|
|
||||||
/* Set the name */
|
/* Set the name */
|
||||||
|
|
@ -237,6 +237,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms) {
|
||||||
{
|
{
|
||||||
Parm *tp = Getattr(n,"templateparms");
|
Parm *tp = Getattr(n,"templateparms");
|
||||||
Parm *p = tparms;
|
Parm *p = tparms;
|
||||||
|
/* Printf(stdout,"%s\n", ParmList_str(tp)); */
|
||||||
|
|
||||||
if (tp) {
|
if (tp) {
|
||||||
while (p && tp) {
|
while (p && tp) {
|
||||||
|
|
@ -244,6 +245,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms) {
|
||||||
int sz, i;
|
int sz, i;
|
||||||
|
|
||||||
name = Getattr(tp,"name");
|
name = Getattr(tp,"name");
|
||||||
|
|
||||||
value = Getattr(p,"value");
|
value = Getattr(p,"value");
|
||||||
tydef = Getattr(p,"typedef");
|
tydef = Getattr(p,"typedef");
|
||||||
|
|
||||||
|
|
@ -254,6 +256,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms) {
|
||||||
} else {
|
} else {
|
||||||
valuestr = SwigType_namestr(value);
|
valuestr = SwigType_namestr(value);
|
||||||
}
|
}
|
||||||
|
/* Printf(stdout,"valuestr = '%s'\n", valuestr); */
|
||||||
assert(value);
|
assert(value);
|
||||||
/* Need to patch default arguments */
|
/* Need to patch default arguments */
|
||||||
{
|
{
|
||||||
|
|
@ -275,7 +278,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms) {
|
||||||
for (i = 0; i < sz; i++) {
|
for (i = 0; i < sz; i++) {
|
||||||
String *s = Getitem(typelist,i);
|
String *s = Getitem(typelist,i);
|
||||||
/* Replace(s,name,value, DOH_REPLACE_ID); */
|
/* Replace(s,name,value, DOH_REPLACE_ID); */
|
||||||
/* Printf(stdout,"name = '%s', s = '%s' --> ", name, s); */
|
/* Printf(stdout,"name = '%s', s = '%s' --> ", name, s); */
|
||||||
SwigType_typename_replace(s,name,value);
|
SwigType_typename_replace(s,name,value);
|
||||||
SwigType_typename_replace(s,tbase,iname);
|
SwigType_typename_replace(s,tbase,iname);
|
||||||
/* Printf(stdout,"'%s'\n", s); */
|
/* Printf(stdout,"'%s'\n", s); */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue