mirror of https://github.com/swig/swig
[R] Fix CopyToR() generated for struct in namespace
Fixes https://sourceforge.net/p/swig/bugs/1147/
This commit is contained in:
parent
25f996a5c8
commit
7813793511
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.1.0 (in progress)
|
Version 4.1.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2022-01-31: mreeez
|
||||||
|
https://sourceforge.net/p/swig/bugs/1147/
|
||||||
|
Fix copyToR() generated for a struct in a namespace.
|
||||||
|
|
||||||
2022-01-29: fschlimb
|
2022-01-29: fschlimb
|
||||||
#655 Better handling of using declarations.
|
#655 Better handling of using declarations.
|
||||||
|
|
||||||
|
|
|
@ -315,6 +315,7 @@ CPP_TEST_CASES += \
|
||||||
namespace_forward_declaration \
|
namespace_forward_declaration \
|
||||||
namespace_nested \
|
namespace_nested \
|
||||||
namespace_spaces \
|
namespace_spaces \
|
||||||
|
namespace_struct \
|
||||||
namespace_template \
|
namespace_template \
|
||||||
namespace_typedef_class \
|
namespace_typedef_class \
|
||||||
namespace_typemap \
|
namespace_typemap \
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
%module namespace_struct
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
// SWIG/R generated bad code for copyToR for a struct in a namespace in SWIG < 4.1.0
|
||||||
|
namespace X { struct Y { int x, y; }; }
|
||||||
|
|
||||||
|
%}
|
|
@ -0,0 +1,11 @@
|
||||||
|
clargs <- commandArgs(trailing=TRUE)
|
||||||
|
source(file.path(clargs[1], "unittest.R"))
|
||||||
|
|
||||||
|
dyn.load(paste("namespace_struct", .Platform$dynlib.ext, sep=""))
|
||||||
|
source("namespace_struct.R")
|
||||||
|
cacheMetaData(1)
|
||||||
|
|
||||||
|
xy = Y()
|
||||||
|
xy$x = as.integer(2)
|
||||||
|
xy$y = as.integer(4)
|
||||||
|
copyToR(xy)
|
|
@ -2569,7 +2569,7 @@ int R::generateCopyRoutines(Node *n) {
|
||||||
|
|
||||||
|
|
||||||
Printf(sfile, "# Start definition of copy methods for %s\n", rclassName);
|
Printf(sfile, "# Start definition of copy methods for %s\n", rclassName);
|
||||||
Printf(sfile, "setMethod('copyToR', '_p_%s', CopyToR%s);\n", rclassName,
|
Printf(sfile, "setMethod('copyToR', '_p%s', CopyToR%s);\n", mangledName,
|
||||||
mangledName);
|
mangledName);
|
||||||
Printf(sfile, "setMethod('copyToC', '%s', CopyToC%s);\n\n", rclassName,
|
Printf(sfile, "setMethod('copyToC', '%s', CopyToC%s);\n\n", rclassName,
|
||||||
mangledName);
|
mangledName);
|
||||||
|
|
Loading…
Reference in New Issue