D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14656 - "auto" of "auto ref" spills over to other function
Summary: "auto" of "auto ref" spills over to other function
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 minor
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-05 20:00 UTC by ag0aep6g
Modified: 2015-06-17 21:05 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ag0aep6g 2015-06-05 20:00:12 UTC
----
void unaryFun()(auto ref int a) pure nothrow @safe @nogc {}
alias Identity(F) = F;
void main()
{
    unaryFun!()(41);
    static void fun(int n) pure nothrow @safe @nogc {}
    alias F = typeof(fun);
    pragma(msg, F); /* ...(int n) */
    pragma(msg, Identity!F); /* ...(auto int) */
}
----

Shouldn't print "auto" as fun has no "auto" on the parameter.
Comment 1 ag0aep6g 2015-06-05 20:08:32 UTC
Forgot to link the forum discussion:
http://forum.dlang.org/post/jqyklfqhmryumilawzod@forum.dlang.org
Comment 2 Daniel Kozak 2015-06-07 15:51:12 UTC
problem is that auto does not affect type mangling, so when type is lookup in table it will return wrong type. To fix it we must make it ilegal to use auto int or change type mangling.
Comment 4 github-bugzilla 2015-06-08 16:43:18 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ee8edc229c91171e5d4c4db7a0e6908c7846cb6d
fix Issue 14656 - "auto" of "auto ref" spills over to other function

https://github.com/D-Programming-Language/dmd/commit/a6065817b8fad6ca18eaf62323bb804633fa9cbe
Merge pull request #4728 from Kozzi11/issue14656

fix Issue 14656 - "auto" of "auto ref" spills over to other function