This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/16845] New: demangler not working for plain "int"


#include <exception>
#include <iostream>
#include <cxxabi.h>

struct empty { };

template <typename T, int N>
  struct bar { };


  int main()
  {
    int     status;
    char   *realname;

    // exception classes not in <stdexcept>, thrown by the implementation
    // instead of the user
    std::bad_exception  e;
    realname = abi::__cxa_demangle(e.what(), 0, 0, &status);
    std::cout << e.what() << "\t=> " << realname << "\t: " << status << '\n';
    free(realname);


    // typeid
    bar<empty,17>          u;
    const std::type_info  &ti = typeid(u);

    realname = abi::__cxa_demangle(ti.name(), 0, 0, &status);
    std::cout << ti.name() << "\t=> " << realname << "\t: " << status << '\n';
    free(realname);

    // typeid
    const std::type_info  &tj = typeid(int);

    realname = abi::__cxa_demangle(tj.name(), 0, 0, &status);
    std::cout << tj.name() << "\t=> " << realname << "\t: " << status << '\n';
    free(realname);

    return 0;
    }


gets you:

~/ootbc/common/src$ a.out
St13bad_exception       => std::bad_exception   : 0
3barI5emptyLi17EE       => bar<empty, 17>       : 0
i       => ~/ootbc/common/src$


It works for some complicated types, but not for plain "int"

Ivan

-- 
           Summary: demangler not working for plain "int"
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16845


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]