digitalmars.D.bugs - [Issue 5957] New: Ambiguous mangling of module and template in template symbol args
- d-bugmail puremagic.com (46/46) May 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5957
- d-bugmail puremagic.com (41/41) May 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5957
http://d.puremagic.com/issues/show_bug.cgi?id=5957 Summary: Ambiguous mangling of module and template in template symbol args Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: kennytm gmail.com --- Comment #0 from kennytm gmail.com 2011-05-08 08:50:17 PDT --- Consider the program: ---------------------------- module y; import std.typecons; template f(alias s) { void f() { } } void g(){} void main() { f!( std.typecons )(); // A f!( f )(); // B f!( g )(); // C } ---------------------------- The manglings are: A: _D1y22__T1fS133std8typeconsZ1fFZv **^^^^^^^^^^^^^ B: _D1y12__T1fS41y1fZ1fFZv *^^^^ C: _D1y17__T1fS9_D1y1gFZvZ1fFZv *^^^^^^^^^ Here, the module 'std.typecons' and 'f' are simply encoded as a QualifiedName, unlike 'g' which is encoded as a MangledName. However, with this it is very hard for the demangler to tell the QualifiedName in A and B only have 13 and 4 characters respectively, instead of 133 and 41. There should be some separator between the 13/4 and the 3/1, or a type should be defined for module and templates, and encode them with MangledName instead of QualifiedName. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 08 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5957 --- Comment #1 from kennytm gmail.com 2011-05-08 10:35:26 PDT --- To show that this bug does affect code more than the demangler, consider the following programs: ----------------------------------- // a146zzzzzza.d template b(){} ----------------------------------- // a.d template zzzzzza1bTC1y130bbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffbbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffggggggggggffffffffffgggggggggg(){} ----------------------------------- // y.d module y; import a146zzzzzza; import a; import std.stdio; class bbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffbbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffggggggggggffffffffffgggggggggg {} template f(s...) { void f(){ writeln(s.stringof); } } void main() { f!( a146zzzzzza.b, bbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffbbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffggggggggggffffffffffgggggggggg )(); f!( a.zzzzzza1bTC1y130bbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffbbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffggggggggggffffffffffgggggggggg )(); } ----------------------------------- The output is: tuple(b(),(bbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffbbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffggggggggggffffffffffgggggggggg)) tuple(b(),(bbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffbbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffggggggggggffffffffffgggggggggg)) as we can see, the 2nd function is shadowed by the 1st as they share the same symbol: _D1y161__T1fS1511a146zzzzzza1bTC1y130bbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffbbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffggggggggggffffffffffggggggggggZ1fFZv -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 08 2011