Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Go: conversion of typedeffed const char * invalid #3290

@ysmilda

Description

@ysmilda

For a project which interfaces Go to C++ we noticed the following behaviour: when converting a custom type with an underlying type of const char* the generated conversion code is invalid.

How to reproduce

By creating the following files and running swig -go -c++ test.i one can observe that the both the Set and SetCustom correctly get a string as input. However the conversion of this string differs, where the conversion for the custom_string is invalid.

test.h

typedef const char *custom_string;

class Test 
{
    public:
    void SetCustom(custom_string input) {
    }
    void Set(const char *input) {
    }
};

test.i

%module test

%{
#include "test.h"
%}

%include "test.h"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions