Skip to content

c++ bindgen issues (resources/imports/includes) #1513

@kavoc-brown

Description

@kavoc-brown

Summary

This issue buckets multiple problems to avoid opening many separate issues at once.

Each sub-item is independently reproducible and causes the generated C++ to fail to compile.

If you prefer, I can split this bucket into separate issues.

Environment

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

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

Details

Sub-issue 1

C++ fails to compile.

Reproduction

package demo:poc;

interface host {
  resource r;
}

world w {
  import host;
  use host.{r};
  export take: func(x: r);
}

Sub-issue 2

missing wit.h

Reproduction

package demo:poc;

interface i {
  resource r;
  f: func(x: borrow<r>);
}

world w {
  export i;
}

Sub-issue 3

C++ fails to compile.

Reproduction

package demo:poc;

interface i {
  resource r;
  take-many: func(xs: list<own<r>>);
}

world w {
  import i;
}

Sub-issue 4

C++ fails to compile.

Reproduction

package demo:poc;

world w {
  export f: func() -> result<u32>;
}

Sub-issue 5

C++ fails to compile.

Reproduction

package demo:poc;

world w {
  record t {
    x: u32,
  }

  import foo: func(x: t);
}

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