Skip to content

Overloaded function renaming might cause conflicts #1316

Open
@hfiguiere

Description

@hfiguiere

Describe the bug

Overloaded function renaming might cause conflicts

To Reproduce

See #1317

I have a class:

class Image {
public:
  static uint64_t byteSwap(uint64_t value, bool bSwap);
  static uint32_t byteSwap(uint32_t value, bool bSwap);
  static uint16_t byteSwap(uint16_t value, bool bSwap);
  static uint16_t byteSwap2(const DataBuf& buf, size_t offset, bool bSwap);
};

calling generate! on it will cause byteSwap2 to be generated twice. One for the overload, one for the actual byteSwap2.

pub unsafe fn byteSwap(value: u64, bSwap: bool) -> u64 { }
pub unsafe fn byteSwap1(value: u32, bSwap: bool) -> u32 { }
pub unsafe fn byteSwap2(value: u16, bSwap: bool) -> u16 { }
pub unsafe fn byteSwap2(buf: &root::Exiv2::DataBuf,
       offset: usize,
       bSwap: bool,
) -> u16 {}

This is because the renaming of the return u16 overload is byteSwap2 and there is an actual byteSwap2 function.

Expected behavior

Find a better renaming.

Or throw an error from the macro

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershas-test-caseTest case written and checked in

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions