Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typedef issue between member function and static member function #177

Closed
durswd opened this issue May 17, 2014 · 2 comments
Closed

typedef issue between member function and static member function #177

durswd opened this issue May 17, 2014 · 2 comments
Labels

Comments

@durswd
Copy link

durswd commented May 17, 2014

I wrote a .i file and generated C# wrapper on swig 3.0.0

typedef unsigned int utf32;
%typemap(ctype) const utf32* "utf32*"
%typemap(ctype) utf32* "utf32*"

class TestClass
{
public:
    void Test( const utf32* v);
    static void TestStatic( const utf32* v);
};

The wrapper is generated as follows.

SWIGEXPORT void SWIGSTDCALL CSharp_TestClass_Test(void * jarg1, utf32* jarg2) {
  TestClass *arg1 = (TestClass *) 0 ;
  utf32 *arg2 = (utf32 *) 0 ;

  arg1 = (TestClass *)jarg1; 
  arg2 = (utf32 *)jarg2; 
  (arg1)->Test((utf32 const *)arg2);
}

SWIGEXPORT void SWIGSTDCALL CSharp_TestClass_TestStatic(utf32* jarg1) {
  utf32 *arg1 = (utf32 *) 0 ;

  arg1 = (utf32 *)jarg1; 
  TestClass::TestStatic((unsigned int const *)arg1);
}

In the member function, arg2 is cast to utf32 const_.
On the other hand, in the static member function, arg1 is cast to unsigned int cont_.
Normally, it is no problem. But I think that it is a bug.

@ojwb
Copy link
Member

ojwb commented Sep 9, 2016

I'm failing to see how this could actually cause a problem - can you supply a small, self-contained reproducer?

@ojwb ojwb added the C# label Sep 9, 2016
@ojwb
Copy link
Member

ojwb commented Dec 23, 2021

5 years on there's been no response. I checked and git master still produces the same code, but it doesn't seem useful to keep this open indefinitely when it doesn't seem there's actually a problem here - just a harmless quirk that a different name (via typedef) for the type is used in the two situations.

So I'm going to close this. If anyone has a reproducer, or can even just explain when this would be a problem, please follow up and we can reopen.

@ojwb ojwb closed this as completed Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants