Bug 4697 – std.demangle doesn't work correctly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-08-20T16:10:00Z
Last change time
2012-10-21T21:30:04Z
Assigned to
nobody
Creator
necroment

Comments

Comment #0 by necroment — 2010-08-20T16:10:03Z
import std.demangle, std.stdio; void main() { auto a = (float x, char y) { return 0; }; auto b = [ 1, 2, 3 ]; auto c = 3.5; writeln(demangle(a.mangleof)); writeln(demangle(b.mangleof)); writeln(demangle(c.mangleof)); writeln(demangle("_D3std4math3cosFNaNbeZe")); writeln(demangle("_D3std3utf6toUTF8FG4awZAa")); writeln(demangle("_D3std6string7sformatFAaYAa")); } output: DFfaZi Ai d _D3std4math3cosFNaNbeZe char[] std.utf.toUTF8(char[4], dchar) char[] std.string.sformat(char[], ...) So it does unmangle some of the symbols, but it's very limited currently.
Comment #1 by sean — 2011-01-11T14:24:23Z
demangle now handles the _D symbols below, but not the .mangleof strings. This is by design, since the .mangleof strings aren't complete symbol names per the spec. I suppose a function should be added to handle the .mangleof strings though.
Comment #2 by lovelydear — 2012-04-21T15:28:20Z
2.059: PS E:\DigitalMars\dmd2\samples> rdmd bug.d void bug.main().pure nothrow @safe int function(float, char)* a void bug.main().int[] b void bug.main().double c pure nothrow real std.math.cos(real) char[] std.utf.toUTF8(char[4], dchar) char[] std.string.sformat(char[], ...) PS E:\DigitalMars\dmd2\samples>