cxa_demangle.cxx 426 B

12345678910111213141516171819
  1. // Test for cross-vendor C++ ABI's __cxa_demangle function.
  2. #include <cstdlib>
  3. #include <cstring>
  4. #include <stdexcept>
  5. #include <typeinfo>
  6. #include <cxxabi.h>
  7. int main()
  8. {
  9. int status = 0;
  10. char *name =
  11. abi::__cxa_demangle(typeid(10).name(), nullptr, nullptr, &status);
  12. if (status != 0)
  13. throw std::runtime_error("Demangle failed!");
  14. int result = std::strcmp(name, "int");
  15. std::free(name);
  16. return result;
  17. }