Thread overview | |||||
---|---|---|---|---|---|
|
October 03, 2012 [Issue 8749] New: Wrong mangling of in parameters | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-03 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: ------- |
October 04, 2012 [Issue 8749] Wrong mangling of in parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=8749 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-10-04 07:36:17 PDT --- 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: ------- |
October 04, 2012 [Issue 8749] Wrong mangling of in parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=8749 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-10-04 11:23:32 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: ------- |
Copyright © 1999-2021 by the D Language Foundation