public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/16848] New: code in /ext/demangle.h appears broken
@ 2004-08-01  2:51 igodard at pacbell dot net
  2004-08-01  2:54 ` [Bug libstdc++/16848] " igodard at pacbell dot net
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: igodard at pacbell dot net @ 2004-08-01  2:51 UTC (permalink / raw)
  To: gcc-bugs

In bug #16845 the suggested workaround for OP was to use the demangler located in /ext/demangle.h. In:

#include    <memory>
#include    <typeinfo>
#include    <ext/demangle.h>
using namespace __gnu_cxx;
using namespace demangler;
using namespace std;
typedef demangle<char, allocator<char> > demang;
int main() {
    implementation_details id;
    const char* name = typeid(int).name();
    demang::type(name, id);
    return 0;
    }

we see several problems:

1) The template "demangle" takes two typename arguments. The first appears to be never used.

2) The template "demangle" is commented as constituting the public interface. However, it exports functions which take mandatory (not with default) arguments of type "implementation_details", which type is declared in the local namespace "demangler". There exists no public data of this type. A public interface that requires use of a private type cannot be called public :-)

3) There is no default value for the allocator (second) argument to template "demangle", forcing the user to explicitly supply one. This violates the conventions used throughout the standard library.

4) There is no default value for the "implementation_details" argument to the member functions of "demangle". As a minimum an overload should default to the conventions observed by the compiler RTTI/debugger interface itself, so that strings produced by the demangler can be compared with those appearing in listings and regression files.

5) There is no usage documentation that either I or Google can find. All examples available refer to the demangler in cxxabi.h, which has a "C" interface and fails to parse mangled types (cf. bug #16845).

6) The above code fails to compile in 3.4.0. I struggled for a while trying to find out what was wrong, but frankly the compiler output for this is something only a mother would love. 

Ivan

-- 
           Summary: code in /ext/demangle.h appears broken
           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=16848


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-09-27 17:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-01  2:51 [Bug libstdc++/16848] New: code in /ext/demangle.h appears broken igodard at pacbell dot net
2004-08-01  2:54 ` [Bug libstdc++/16848] " igodard at pacbell dot net
2004-08-01 18:44 ` pcarlini at suse dot de
2004-08-01 20:13 ` carlo at gcc dot gnu dot org
2004-08-01 21:02 ` igodard at pacbell dot net
2004-08-02 13:26 ` bangerth at dealii dot org
2004-08-02 13:43 ` pcarlini at suse dot de
2004-09-02 16:56 ` cvs-commit at gcc dot gnu dot org
2004-09-23 18:20 ` pinskia at gcc dot gnu dot org
2004-09-27 17:26 ` cvs-commit at gcc dot gnu dot org
2004-09-27 17:28 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).