简体   繁体   English

为什么OSX上的异常不能与gcc7和-static-libgcc一起使用?

[英]Why don't exceptions work with gcc7 and -static-libgcc on OSX?

If I compile this simple program with gcc-7, -static-libstdc++ , and -static-libgcc ; 如果我使用gcc-7, -static-libstdc++-static-libgcc编译这个简单的程序; then run on OSX 然后在OSX上运行

#include <exception>
#include <iostream>

int main() try {
  throw std::runtime_error{"abc123"};
  return 0;
} catch (const std::runtime_error& e) {
  std::cout << e.what() << "\n";
  return 0;
}

it fails with error code 134. 它失败,错误代码为134。

Why doesn't it print "abc123" as it does when compiled with the same options on linux? 为什么它不打印“abc123”,就像在linux上使用相同的选项编译时一样?

Fixed(-ish) in GCC8; 固定(-ish)在GCC8中; see update to PR86215 and the related PR80556 . 请参阅PR86215及相关PR80556的更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM