Skip to content

c++ bindgen can have multiple name collisions #1514

@kavoc-brown

Description

@kavoc-brown

Summary

Another bucket of issues in wit-bindgen cpp.

Each one still makes the generated C++ fail to compile, possibly due to name collisions.

I can split this bucket into separate issues if needed.

Environment

  • wit-bindgen-cli: 0.47.0
  • OS: Ubuntu 22.04.5 LTS (x86_64)

Same compile command: clang++ -c "$OUT/w.cpp" -I"$OUT" -o "$OUT/w.o".

Details

Sub-issue 1

Reproduction

package demo:poc;

world w {
  export a: interface {
    f: func() -> u32;
  }

  export b: interface {
    f: func() -> u64;
  }
}

Sub-issue 2

Reproduction

package namespace:demo;

interface i {
  f: func();
}

world w {
  export i;
}

Sub-issue 3

Reproduction

package demo:poc;

world w {
  import foo: func(ptr0: string) -> u32;
}

Sub-issue 4

Reproduction

package demo:poc;

world w {
  import foo: func(class: u32) -> u32;
}

Sub-issue 5

Reproduction

package demo:poc;

interface i {
  record t {
    ret: u32,
  }

  foo: func(x: t);
}

world w {
  import i;
}

Sub-issue 6

Reproduction

package demo:poc;

interface i {
  variant v {
    v,
  }
  f: func(x: v);
}

world w {
  export i;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    gen-cppRelated to the C++ code generator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions