Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Apr 4, 2020
1 parent 350eca5 commit 2cbaa42
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions include/internal/iutest_internal_defs.hpp
Expand Up @@ -325,15 +325,18 @@ inline ::std::string GetTypeName()

#if IUTEST_HAS_HDR_CXXABI
using abi::__cxa_demangle;
char buf[1024];
size_t size = sizeof(buf);
size_t size = 0;
int status=1;
char* const read_name = __cxa_demangle(name, buf, &size, &status);
::std::string str(status == 0 ? read_name : name);
return str;
#else
return name;
char* const read_name = __cxa_demangle(name, NULL, &size, &status);
if( status == 0 )
{
read_name[size - 1] = '\0';
::std::string str(read_name);
free(read_name);
return str;
}
#endif
return name;

#else
return "<type>";
Expand Down

0 comments on commit 2cbaa42

Please sign in to comment.