www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2445] New: D2 std.demangle example doesn't compile

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2445

           Summary: D2 std.demangle example doesn't compile
           Product: D
           Version: 2.019
          Platform: PC
               URL: http://www.digitalmars.com/d/2.0/phobos/std_demangle.htm
                    l
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: smjg iname.com


The example given on the std.demangle page fails to compile with the errors:

demangle.d(19): function std.demangle.demangle (invariant(char)[] name) does
not
 match parameter types (char[])
demangle.d(19): Error: cannot implicitly convert expression (buffer) of type
cha
r[] to invariant(char)[]


-- 
Nov 07 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2445


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dhasenan gmail.com




------- Comment #1 from smjg iname.com  2009-04-25 08:14 -------
*** Bug 2896 has been marked as a duplicate of this bug. ***


-- 
Apr 25 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2445


Trass3r <mrmocool gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec
                 CC|                            |mrmocool gmx.de
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #2 from Trass3r <mrmocool gmx.de> 2010-07-29 17:06:31 PDT ---
Also fgetc and writef give errors. Here's a working example (2.047):

import std.stdio;
import std.ctype;
import std.demangle;

int main()
{   string buffer;
    bool inword;
    foreach(c; InputByChar(stdin))
    {
        if (inword)
        {
            if (c == '_' || isalnum(c))
                buffer ~= cast(char) c;
            else
            {
                inword = false;
                write(demangle(buffer), cast(char) c);
            }
        }
        else
        {   if (c == '_' || isalpha(c))
            {        inword = true;
                buffer.length = 0;
                buffer ~= cast(char) c;
            }
            else
                write(cast(char) c);
        }
    }
    if (inword)
        write(demangle(buffer));
    return 0;
}

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