[Issue 4852] New: core.demangle cannot demangle functions with class/struct return types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 11 05:05:50 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4852

           Summary: core.demangle cannot demangle functions with
                    class/struct return types
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: sean at invisibleduck.org
        ReportedBy: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2010-09-11 05:05:20 PDT ---
There are similar bug reports regarding std.demangle, but as it is
reimplemented in core.demangle, I've created this new bug report.

for example:
_D3dmd6Parser6Parser15parsePrimaryExpMFZC3dmd10Expression10Expression

if demangled to 
dmd dmd.Parser.Parser.parsePrimaryExp()

but it should be
dmd.Expression.Expression dmd.Parser.Parser.parsePrimaryExp()

This is caused by parseLName() not continue reading after eating the first
identifier of the fully qualified class name.

Index: demangle.d
===================================================================
--- demangle.d    (revision 390)
+++ demangle.d    (working copy)
@@ -378,20 +378,26 @@
         debug(trace) printf( "parseLName+\n" );
         debug(trace) scope(success) printf( "parseLName-\n" );

-        auto n = decodeNumber();
+        while( true )
+        {
+            auto n = decodeNumber();

-        if( !n || n > buf.length || n > buf.length - pos )
-            error( "LName must be at least 1 character" );
-        if( '_' != tok() && !isAlpha( tok() ) )
-            error( "Invalid character in LName" );
-        foreach( e; buf[pos + 1 .. pos + n] )
-        {
-            if( '_' != e && !isAlpha( e ) && !isDigit( e ) )
+            if( !n || n > buf.length || n > buf.length - pos )
+                error( "LName must be at least 1 character" );
+            if( '_' != tok() && !isAlpha( tok() ) )
                 error( "Invalid character in LName" );
+            foreach( e; buf[pos + 1 .. pos + n] )
+            {
+                if( '_' != e && !isAlpha( e ) && !isDigit( e ) )
+                    error( "Invalid character in LName" );
+            }
+
+            put( buf[pos .. pos + n] );
+            pos += n;
+            if( !isDigit( tok() ) )
+                break;
+            put( "." );
         }
-
-        put( buf[pos .. pos + n] );
-        pos += n;
     }

     /*

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list