23#if defined(HAVE_GCC_ABI_DEMANGLE) && defined(HAVE_TEUCHOS_DEMANGLE)
25 char* _demangledName = abi::__cxa_demangle (mangledName.c_str (), 0, 0, &status);
26 if (status != 0 || 0 == _demangledName) {
29 std::string nullstr (
"NULL");
30 const char* demangle_output = _demangledName ? _demangledName : nullstr.c_str ();
33 if (_demangledName != NULL) {
36 free (_demangledName);
40 true, std::logic_error,
41 "Error, name demangling with g++ has been enabled but the function "
42 "abi::__cxa_demangle(" << mangledName <<
") returned returnVal = " <<
43 demangle_output <<
" and status = " << status <<
"." << endl <<
"This "
44 "suggests that name demangling may be broken on this platform." << endl
45 <<
"You may prevent this exception from being thrown in the future by "
46 "turning off name demangling for this build at configure time." << endl
47 <<
"Do this by setting the CMake configuration option "
48 "Teuchos_ENABLE_GCC_DEMANGLE to OFF." << endl <<
"Add the following to "
49 "your list of CMake options:" << endl << endl <<
50 " -D Teuchos_ENABLE_GCC_DEMANGLE:BOOL=OFF" << endl);
52 return (mangledName +
"<demangle-failed>");
55 const std::string demangledName (_demangledName);
56 free (_demangledName);