Bug 2445 – D2 std.demangle example doesn't compile

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2008-11-07T13:59:00Z
Last change time
2015-06-09T01:20:16Z
Keywords
pull
Assigned to
nobody
Creator
smjg

Comments

Comment #0 by smjg — 2008-11-07T13:59:32Z
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)[]
Comment #1 by smjg — 2009-04-25T08:14:57Z
*** Bug 2896 has been marked as a duplicate of this bug. ***
Comment #2 by hoganmeier — 2010-07-29T17:06:31Z
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; }
Comment #3 by bugzilla — 2012-01-22T16:50:09Z
This doesn't work either; InputByChar is not defined. Also, not a spec issue.
Comment #4 by andrej.mitrovich — 2012-12-01T17:00:08Z
Comment #5 by github-bugzilla — 2012-12-02T04:33:19Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/a3d4857858fd096c07be283c28a58ffe4a8b665f Fixes Issue 2445 - std.demangle example won't compile. https://github.com/D-Programming-Language/phobos/commit/e47718f15d3d9d57439e5b52c8861d201b9c96dd Merge pull request #986 from AndrejMitrovic/Fix2445 Fixes Issue 2445 - std.demangle example won't compile.