Skip to content

Commit

Permalink
The ValKind::operator<< uses ostream, but the include was missing. os…
Browse files Browse the repository at this point in the history
…tream is used so commonly that it's usually included by some other header. However, if you use wasmtime.hh as your first (or only) include, then you get a massive compile error on Apple toolchain compilers (I'm using xcode 16). The error does not reproduce on Linux. (#60)

The error when this include is missing is:
```
include/wasmtime.hh:519:32: error: invalid operands to binary expression ('std::ostream' (aka 'basic_ostream<char>') and 'const char[4]')
  519 |     WASMTIME_FOR_EACH_VAL_KIND(CASE_KIND_PRINT_NAME)
third-party/wasmtime-cpp/include/wasmtime.hh:504:3: note: expanded from macro 'WASMTIME_FOR_EACH_VAL_KIND'
  504 |   X(I32, "i32", WASM_I32)                                                      \
      |   ^~~~~~~~~~~~~~~~~~~~~~~
third-party/wasmtime-cpp/include/wasmtime.hh:517:8: note: expanded from macro 'CASE_KIND_PRINT_NAME'
  517 |     os << name;                                                                \
```
  • Loading branch information
Daniel9z authored Dec 6, 2024
1 parent af885c2 commit c0aa342
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/hello.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <wasmtime.hh>
#include <fstream>
#include <iostream>
#include <sstream>
#include <wasmtime.hh>

using namespace wasmtime;

Expand Down
1 change: 1 addition & 0 deletions include/wasmtime.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <limits>
#include <memory>
#include <optional>
#include <ostream>
#include <variant>
#include <vector>
#ifdef __has_include
Expand Down

0 comments on commit c0aa342

Please sign in to comment.