Thread overview
[Issue 5718] New: Can't demangle symbol defined inside unittest block
Mar 08, 2011
Nick Sabalausky
Jan 31, 2012
Walter Bright
Jan 31, 2012
Kenji Hara
Jan 31, 2012
Walter Bright
Feb 01, 2012
Kenji Hara
Feb 01, 2012
Walter Bright
March 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5718

           Summary: Can't demangle symbol defined inside unittest block
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: cbkbbejeap@mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-03-07 20:11:36 PST ---
This worked on 2.050, but fails on 2.052:

---------------------
// demangleUnittestIdent.d
import std.stdio, std.traits, std.demangle;
unittest
{
    int foo;
    writeln( demangle( mangledName!foo ) );
}
void main(){}
---------------------

>dmd demangleUnittestIdent.d -unittest

2.050 result: void demangleUnittestIdent.__unittest1() . int foo
2.052 result:
nt11__unittest1FZv59__T5DummyS46_D21demangleUnittestIdent11__unittest1FZv3fooi

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 31, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5718


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2012-01-31 01:55:27 PST ---
This appears to be a problem with std.traits.mangledName, as:

  import std.stdio, std.traits, std.demangle;

  unittest
  {
    int foo;
    writeln( foo.mangleof );
    writeln( mangledName!foo );
  }
  void main(){}

prints:

  _D3foo11__unittest1FZv3fooi
  0__T5DummyS27_D3foo11__unittest1FZv3fooi

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 31, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5718



--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-01-31 06:54:32 PST ---
std.traits.mangledName is a workaround for old dmd bugs.
Now built-in mangleof property almost works correctly, so deprecating it is
better.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 31, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5718



--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2012-01-31 15:47:41 PST ---
Ok, can you do a pull request for deprecating it, and then we can close this?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5718


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2012-02-01 07:44:09 PST ---
(In reply to comment #4)
> Ok, can you do a pull request for deprecating it, and then we can close this?

Sorry, I had mistaken. std.traits.mangledName has an extra feature against the built-in mangleof property. It returns a pseudo mangled name from given template symbol.

// from unittest
assert(mangledName!mangledName == "3std6traits11mangledName");

It is useful for getting unique string from template symbol, even if std.demangle.demangle() cannot demangle it.

Therefore, now I cannot recommend to deprecate it.
But we can fix the original issue. Please merge following pull:

https://github.com/D-Programming-Language/phobos/pull/414

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5718


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2012-02-01 14:26:53 PST ---
That pull fixes it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5718



--- Comment #7 from github-bugzilla@puremagic.com 2012-02-01 14:32:50 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/686f53f6d2d373ad13ea854b52e924fd7030422f Issue 5718 - Can't demangle symbol defined inside unittest block

std.traits.mangledName should return valid mangled name against symbols in function.

https://github.com/D-Programming-Language/phobos/commit/ac88792ea1a15a4815679359b69e731868db4391 Merge pull request #414 from 9rnsr/fix5718

Issue 5718 - Can't demangle symbol defined inside unittest block

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