Skip to content

zig c++ does not support exceptions on macos #12992

@prenaux

Description

@prenaux

Zig Version

0.10.0-dev.4192+c75e8f361

Steps to Reproduce

Initially tested on 0.10.0-dev.2377+71e2a56e3, same thing happens on 0.10.0-dev.4192+c75e8f361

Same issue as #9591 but for macOS arm64 (on an M1 mbp).

yikes.cpp:

#include <iostream>
#include <exception>

int main() {
  try {
    throw std::exception();
  } catch (std::exception &) {
    std::cerr << "yikes";
  }
  return 0;
}

Expected Behavior

With clang:

$ clang++ yikes.cpp && ./a.out
yikes

Actual Behavior

With zig c++:

$ zig c++ yikes.cpp && ./a.out
libc++abi: terminating due to uncaught exception of type std::exception: std::exception
Abort trap: 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavioros-macoszig ccZig as a drop-in C compiler feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions