www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8749] New: Wrong mangling of in parameters

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

           Summary: Wrong mangling of in parameters
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



16:00:33 PDT ---
import std.stdio;

void foo(const int x) { }
void bar(const scope int x) { }
void doo(in int x) { }

void main()
{
    writeln(foo.mangleof);
    writeln(bar.mangleof);
    writeln(doo.mangleof);
}

_D4test3fooFxiZv
_D4test3barFMxiZv
_D4test3dooFxiZv

'doo' should have the same mangling as 'bar', but it has mangling as 'foo'.
Fixing this will fix Issue 8695.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 03 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8749




This is difficult issue. Because, with current dmd, scope parameter does
affects only for delegate types. For other types, it has no meaning.

Furthermore, the equality 'in' == 'const scope' is almost a lie.
In semantic phase, 'in' storage class is directly translated to 'const' storage
class, then affects to the parameter type. There is no appearance of 'scope'.

  void foo(const scope void delegate() dg){}
  void bar(         in void delegate() dg){}
  pragma(msg, typeof(foo));  // void(scope const(void delegate()) dg)
  pragma(msg, typeof(bar));  // void(const(void delegate()) dg)

Therefore, it seems to me that the mangling difference is just for backward
compatibility. It is almost redundant, but does not existing code...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 04 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8749


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg gmx.com



PDT ---
scope is _supposed_ to affect all reference types. The fact that it doesn't is
a bug in dmd.

Regardless, I would have expected that in would literally be replaced with
const scope during the compilation process rather than using it directly in any
way. And given that in is supposed to be an alias for const scope, the fact
that in is being handled directly rather than being converted to const scope
before being processed probably should be changed.

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